a tool to normalize different writing of phone numbers into standard format
Project description
Phone-Normalizer
What is Phone Normalizer?
Phone Normalizer 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:
+18175698900
Install
$ pip install norm4phone
Usage
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
norm4phone-0.1.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for norm4phone-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7a71a27960f327883c58ce37ddee00a30108992807c55a6c9740c8bb1302af2 |
|
MD5 | 54b96f4df8db83026b1469c03419cb69 |
|
BLAKE2b-256 | efa802551f4d124003ca0ac474f6c5de8f76f9f6d2e0ec60c4a05ea22fe88a36 |