2 Show how to use it to get a country name.
source | link

There are a couple of python libraries that can do this python-phonenumbers will parse various formats to get the country code.

  • Free & Open Source.
  • Works offline
  • Cross platform & OS
  • Python 2.5-2.7 & 3.x
  • Pure Python so no C compiler needed.

Based on the examples from that page and using ipython:

In [1]: import phonenumbers

In [2]: from phonenumbers import geocoder

In [3]: query = phonenumbers.parse("+27823374587", None)

In [4]: print repr(geocoder.description_for_number(query, "en"))

u'South Africa'

There are a couple of python libraries that can do this python-phonenumbers will parse various formats to get the country code.

  • Free & Open Source.
  • Works offline
  • Cross platform & OS
  • Python 2.5-2.7 & 3.x
  • Pure Python so no C compiler needed.

There are a couple of python libraries that can do this python-phonenumbers will parse various formats to get the country code.

  • Free & Open Source.
  • Works offline
  • Cross platform & OS
  • Python 2.5-2.7 & 3.x
  • Pure Python so no C compiler needed.

Based on the examples from that page and using ipython:

In [1]: import phonenumbers

In [2]: from phonenumbers import geocoder

In [3]: query = phonenumbers.parse("+27823374587", None)

In [4]: print repr(geocoder.description_for_number(query, "en"))

u'South Africa'

1
source | link

There are a couple of python libraries that can do this python-phonenumbers will parse various formats to get the country code.

  • Free & Open Source.
  • Works offline
  • Cross platform & OS
  • Python 2.5-2.7 & 3.x
  • Pure Python so no C compiler needed.