Skip to main content

a tool to normalize different writing of phone numbers into standard format

Project description


What is norm4phone?

norm4phone is a python implement of AfterShip/phone

A common problem is that users normally input phone numbers in this way:

`(817) 569-8900` or
`817569-8900` or
`1(817) 569-8900` or
`+1(817) 569-8900` or ...

We always want:



$ pip install norm4phone


from norm4phone import PhoneNormalizer
pn = PhoneNormalizer(default_country='China')
pn.parse('+8613314672720') //return ['+8613314672720', 'CHN']
pn.parse('+86 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('13314672720') //return['+8613314672720', 'CHN']
pn.parse('86 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('(86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('(+86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('+(86) 13314672720') //return ['+8613314672720', 'CHN']
pn.parse('+86 133-146-72720') //return ['+8613314672720', 'CHN']
pn.parse('1 6479392750') //return ['+16479392750', 'CAN']

If you want to validate landline phone numbers, set allowLandline to true:

pn.parse('+(852) 2356-4902', '', true)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for norm4phone, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size norm4phone-0.1.2-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size norm4phone-0.1.2.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page