Giter VIP home page Giter VIP logo

bhargavkadali39 / phonenumbers Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 8 KB

Python is a very powerful language and also very rich in libraries. Phone numbers are one of the modules that provide numerous features like providing basic information about a phone number, validation of a phone number, etc. Here, we will learn how to use the phone numbers module just by writing simple Python programs. Some of the use cases are, Get Timezone: Here is the simple Python program to get the timezone of a phone number using the phone numbers module. First, we do parse the string input to phone number format, and then we use an inbuilt function to get the timezone of a user. It gives the output for valid numbers only, so do check if there is no relevant output. ex: timezone.time_zones_for_number(mobileNumber) Carrier and Region of a Phone Number: Here we will learn how to find the carrier and region of a phone number using the geocoder and carrier functions of this module. Here we can choose multiple languages to display the result. ex for the carrier: carrier.name_for_number(mobileNumber, "en") ex for region: geocoder.description_for_number(mobileNumber, "hi") Validation of a phone number: A simple python program, to check whether a given phone number is valid or not (e.g. it’s in an assigned exchange), and to check whether a given phone number is possible or not (e.g. it has the right number of digits). ex: phone numbers.is_valid_number (mobileNumber)

Python 100.00%
phone-number phone phone-number-validation phone-number-information phone-number-scraping phone-number-validation-python python3 python

phonenumbers's Introduction

phonenumbers

Python is a very powerful language and also very rich in libraries. Phonenumbers are one of the modules that provides numerous features like providing basic information about a phone number, validation of a phone number etc.

Here, we will learn how to use phonenumbers module just by writing simple Python programs.

First use the below command to install required module.

pip install phonenumbers

Some of the use cases are, Get Timezone: Here is the simple Python program to get the timezone of a phone number using phonenumbers module. First, we do parse the string input to phonenumber format, and then we use an inbuilt function to get the timezone of a user. It gives the output for valid numbers only,so do check if there is no relevant output.

ex: timezone.time_zones_for_number(mobileNumber)

Carrier and Region of a Phone Number: Here we will learn how to find the carrier and region of a phone number using the geocoder and carrier functions of this module.Here we can choose multiple languages to display the result.

ex for carrier : carrier.name_for_number(mobileNumber, "en") ex for region: geocoder.description_for_number(mobileNumber, "hi")

Validation of a phone number: A simple python program, to check whether a given phone number is valid or not (e.g. it’s in an assigned exchange), and to check whether a given phone number is possible or not (e.g. it has the right number of digits).

ex: phonenumbers.is_valid_number (mobileNumber)

Test output:
Enter the mobile number with the country ID
Ex +129876543210

+91xxxxxxxxxx
('Asia/Calcutta',)
Reliance Jio
भारत
Valid cellular phone number: True
Checking possibility of Number : True

phonenumbers's People

Contributors

bhargavkadali39 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

vulkjjc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.