Skip to main content

Japanese Telephone Number Utility

Project description

jptel は日本の電話番号を市外局番・市内局番・加入者番号に分割して返します。

This package is utility for japaneses telephone number.

インストール

$ pip install jptel

使い方

>>> import jptel
>>> jptel.normalize('0123456789')
'0123-45-6789'
>>> jptel.normalize('0123456789')
'0123-45-6789'

>>> jptel.validate('0123456789')
True
>>> jptel.validate('022252-2222')
False

>>> jptel.split('0312345678')
{'area_code': '03', 'city_code': '1234',   'subscriber_code': '5678'}
>>> jptel.split('00000000000')
exception.InvalidTelephoneNumberException

その他

固定電話の市外局番データは総務省のサイトからダウンロードできるExcelから生成しています。 再生成する場合は以下の手順で行って下さい。

$ pip install -r dev_requirements.txt
$ python _generate_master_data.py

Project details


Download files

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

Source Distribution

jptel-0.1.2.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

jptel-0.1.2-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page