Skip to main content

python program to Print Starting Series OF Indian Mobile Number for a State or operator or both

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")



 

Comments

  1. Your Affiliate Money Printing Machine is ready -

    And 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

    ReplyDelete
  2. If you're looking to lose kilograms then you certainly need to try this totally brand new personalized keto meal plan.

    To 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.

    ReplyDelete

Post a Comment

share your thoughts ....

Popular posts from this blog

13 websites to register your free domain

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...

what is LOREM ipsum and why do designers use it

What is Lorem Ipsum? Lorem Ipsum  is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Why do we use it? It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now...

how free is microsoft sql server developer edition really

Five reasons to take a chance It is free – although the commercially licensed version of SQL Server is often less expensive that other leading database products anyway, you cannot get it cheaper than for zero cost. While it may only be used for non-operational purposes, the developer edition is still a good way of trying out new functions, testing, training, and so on. It is fully loaded – it has all the same functions as the licensed SQL Server 2016 Enterprise edition, not a cut down version. This is important if you are using it to build applications that will eventually become real products or services. It is unlimited – you can deploy any number of copies on an unlimited number of devices, including virtual machines hosted on multitenant infrastructure. It is easily downgradeable – you can use the license to access SQL Server 2014 Developer Edition, without having to acquire a separate license for it. It is free – did I mention that already? Five reasons to skip this opti...

How to Make Your Website or Blog Visible to Search Engine?

If anyone has to search anything over Internet they use search engine websites and every webmaster have desire that there website should show on top for related keyword. For new blogger or website owner they have first question how to make their website visible to search engine. If your website is not listed on search engine then you can’t expect any traffic from search engine. Here are few steps to make your website visible to search engine and get some good search engine traffic quickly. Before beginning I just want to say that don’t think of submitting your website to every search engine. Just focus on top three search engines Google, Yahoo and Bing these three search engine will bring most of search engine traffic so don’t waste your time on other search engines

SQL Server 2016 RTM full and final version available – Download it

–> Download SQL Server: To download SQL Server 2016 you can  Register and Download  the SQL Server 2016 Full or free Evaluation version (180 days) here. Or you can  Direct download  the DVD ISO file image (~2.1 GB)  SQLServer2016-x64-ENU.iso   –> Free Developer Version: Microsoft on March 2016 announced that going forward the Developer version of SQL Server any release will be free for Developers and Learning purpose.  Register and Download  the Developer version. Or you can  Directly download  the DVD ISO image (~2.1 GB):  en_sql_server_2016_developer_x64_dvd_8777069.iso This  Developer version  is meant for  development and testing  only, and  not for production environments  or for use with production data. For more info please check my  previous blog post .   –> One big Update on SSMS: From now onward SSMS i.e. SQL Server Management Studio will not be part of SQL ...

FIXED : Google adsense error in inserting code to blog throwing error Attribute name "async" associated with an element type "script" must be followed by the ' = ' character

Error - Asynchronous adsense code in HTML just add ='async' between async and src of your code ... let say my code for adsense is < script async src = 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' ></ script > then do the following...... < script async = 'async' src = 'http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' ></ script > notice the difference this is how you can add that error and display the google ads ..

Windows 10 1703 Fall Creator update/upgrage brings NEW UI ... the fluent Ui

Microsoft is planning to implement these subtle design changes gradually. Some are already available in new updates to existing Windows 10 apps, and more will start to appear in Windows itself as Microsoft updates the operating system with the Fall Creators Update and future updates. "It's going to be a journey," says Microsoft director Aaron Woodman, noting that these design changes will appear over time in Windows and other products. On stage at Build today, Microsoft's Joe Belfiore demonstrated a number of Fluent Design changes. "You're going to see Fluent Design show up in the Windows shell, in our apps, and across devices," explains Joe Belfiore. Microsoft is focusing on light, depth, motion, material, and scale for its Fluent Design, with subtle changes that make the design feel like it's moving during interactions in Windows. An inking demo showed how Microsoft is bringing the pen experience across the entirety of Windows, allowing...

how to write a Factorial program in PROLOG.

So to Write A prolog programming . First Fire up your SWI -PROLOG software. then you will see something like this . Welcome to SWI-Prolog (threaded, 64 bits, version 7.4.2) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit http://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- _ 1. So now go to File>NEW.... and give any name to knowledge base file. I Give it factorial .pl 2.  now write the follwing fact and rules . fact(0,1) . fact(N,R):-  N>0, N1 is N-1, fact(N1,R1), R is N*R1. now press ctrl +s to save  . 3. now close this windows . 4. now in the main window goto file > Consult..... and select your factorial.pl 5. now you can type query like fact(5,X). it will return X=120. done..... here are some screen shot :...