How to get a phone number detail using python

    Hello friend I am back again with new pycode (Python code), in this we will learn to get phone number detail using python. It is to easy and quickly you can get phone number detail without internet connection but you cannot get username using this pycode.
    You can get carrier name, time zone , country name of that phone number or you can check whether the number exist or not, so let start coding.
  1. First of all you have install a module called phonenumbers using the below command in command prompt.
  2. pip install phonenumber
  3. Now open your IDLE or visual studio code were you written this code. Open new file and import all required modules.
  4. #module
    import phonenumbers
    from phonenumbers import carrier, geocoder, timezone 
  5. Now we have to take input from the user, here user type that number with country code for e.g. country code of India is +91 and USA is +11 etc.
  6. mobno=input('Please enter mobile no. with country code:- ')
    mobno = phonenumbers.parse(mobno)
  7. Now first we get time zone of that number.
  8. print("Timezone:-",timezone.time_zones_for_number(mobno))
  9. Now we get carrier name of that number.
  10. print("Carrier Name:-",carrier.name_for_number(mobno, "en"))
  11. Now we get country name of that number.
  12. print("From,",geocoder.description_for_number(mobno, "en"))
  13. Now we check whether number is valid or not.
  14. print("Valid Mobile No.:",phonenumbers.is_valid_number(mobno))
  15. Now we check whether number exist or not.
  16. print("Checking possiblity of Mobile No.:",phonenumbers.is_possible_number(mobno))

Complete code

import phonenumbers
from phonenumbers import carrier, geocoder, timezone
mobno=input('Please enter mobile no. with country code:- ')
mobno = phonenumbers.parse(mobno)

print("Timezone:-",timezone.time_zones_for_number(mobno))

print("Carrier Name:-",carrier.name_for_number(mobno, "en"))

print("From,",geocoder.description_for_number(mobno, "en"))

print("Valid Mobile No.:",phonenumbers.is_valid_number(mobno))

print("Checking possiblity of Mobile No.:",phonenumbers.is_possible_number(mobno))

or
    Code was completed but friend you cannot get the name of that user. If you got any error put it on comment section.
Previous Post Next Post