a tool to normalize different writing of phone numbers into standard format
Project description
norm4phone
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:
+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.2.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file norm4phone-0.1.2.tar.gz
.
File metadata
- Download URL: norm4phone-0.1.2.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9661af738e9726f51c7be01230f5d73029e9f94392b324064707df521611acab |
|
MD5 | 28738e36b1de90b53cc98ac8aeaba175 |
|
BLAKE2b-256 | d97b8f45cde75749315a45c9751bb1562d0931c61ddee689f4f58af7e19f6b02 |
File details
Details for the file norm4phone-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: norm4phone-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7eee09b656672ed1b3c98b36afff67233f5ab6decdb8bf751cdd95adfac5e97 |
|
MD5 | a9866ca4fba0c371ac2a0ce9be0e977b |
|
BLAKE2b-256 | 0096fb6fdae0b779e433c23bf81db187bd2f4051ebf973a74551553a9eb1432c |