import requests import urllib.request import time from bs4 import BeautifulSoup as bs import re url =' https://en.wikipedia.org/wiki/Mobile_telephone_numbering_in_India' state_to_extract="UE" #if set to None all state is considered telecom_to_extracted=None #if set to none all operator from particular city is extracted response = requests.get(url) print(response) soup = bs(response.text,"html.parser") one_a_tag = soup.findAll('tr')[35:] lst=[] for k in one_a_tag: s=k.findAll('td') limit=len(s) i=0 while True: if i==limit: break no=s[i].text i+=1 if i==limit: break operator=s[i].text i+=1 if i==limit: break state=s[i].text i+=1 if i==limit: break res=f"{no} {operator} {state}" if state_to_extract is None : if telecom_to_extracted is None: lst.append(no) elif telecom_to_extracted in res: lst.append(no) else: print("please specify either state or operator or both") input() break elif state_to_extract in res: if telecom_to_extracted is None: lst.append(no) elif telecom_to_extracted in res : lst.append(no) #inteded operator of intended state found else: pass #currently not the intended operator else: pass #currently not the desired State... print(res) print("-"*20) print(lst) stateName="india" if state_to_extract==None else state_to_extract opName="all_operator" if telecom_to_extracted==None else telecom_to_extracted filename=f"{stateName}__{opName}.txt" with open(filename,"w") as f: for z in lst: print(f"writing {z} to file") f.write(z) f.write("\n")
Register your Free Domain Now!! 1) .tk Dot TK is a FREE domain registry for websites on the Internet. It has exactly the same power as other domain extensions, but it’s free! Because it’s free, millions of others have been using .TK domains since 2001 – which makes .TK powerful and very recognizable. Your website will be like www.yourdomainname.tk . It is free for 1 year. It’s a ccTLD domain whixh having the abbreviation Tokelau. To create a .tk domain, Visit www.dot.tk 2) co.cc Co.cc is completely free domain which is mostly used by blogspot bloggers because of it’s easy to use DNS system. Creating a co.cc for blogger is simple ( for instructions- “click here”). Your website will be like www.yourdomainname.co.cc . To create a .co.cc domain, visit www.co.cc 3) co.nr co.nr is too like co.cc. Your website will be like www.yourdomainname.co.nr . You can add it for blogger also.. To create a .co.cc domain, vi...
Your Affiliate Money Printing Machine is ready -
ReplyDeleteAnd getting it running is as simple as 1---2---3!
Here is how it all works...
STEP 1. Tell the system what affiliate products the system will promote
STEP 2. Add PUSH button traffic (it ONLY takes 2 minutes)
STEP 3. Watch the system explode your list and upsell your affiliate products all for you!
Are you ready to start making money??
Click here to activate the system
If you're looking to lose kilograms then you certainly need to try this totally brand new personalized keto meal plan.
ReplyDeleteTo create this service, licensed nutritionists, personal trainers, and chefs joined together to produce keto meal plans that are useful, decent, money-efficient, and fun.
Since their grand opening in early 2019, thousands of individuals have already remodeled their body and well-being with the benefits a certified keto meal plan can offer.
Speaking of benefits: in this link, you'll discover eight scientifically-certified ones offered by the keto meal plan.