pip install phone-db
>>> from phone_db import Session, Phone, Region
>>> session = Session()
>>> session.query(Phone).count()
415284
>>> city = session.query(Region).filter_by(zip_code='100000').first()
>>> if city:
... city.phones.filter_by(type=2).count()
...
6355
>>> num = session.query(Phone).filter_by(number=1761166).first()
>>> if num:
... num.detail()
...
(1761166, '联通', {'province': '北京', 'city': '北京', 'zip_code': '100000', 'area_code': '010'})
id INTEGER NOT NULL,
number INTEGER,
type INTEGER,
region_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(region_id) REFERENCES regions (id)
id INTEGER NOT NULL,
province VARCHAR,
city VARCHAR,
zip_code VARCHAR,
area_code VARCHAR,
PRIMARY KEY (id)
1 移动
2 联通
3 电信
4 电信虚拟运营商
5 联通虚拟运营商
6 移动虚拟运营商
下载phone.db文件,使用sqlitebrowser查看
415284 (updated:2018年10月)