最新全国手机号码归属地信息SQLite数据库2019年2月更新

栏目: 数据库 · 发布时间: 6年前

内容简介:手机号码归属地SQLite数据库Github项目地址:查询数据库中手机号段总条数

手机号码归属地 SQLite 数据库

Github项目地址: github.com/lalala223/p…

安装

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'})
复制代码

数据表结构

phones表

id INTEGER NOT NULL,
number INTEGER,
type INTEGER,
region_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(region_id) REFERENCES regions (id)
复制代码

regions表

id INTEGER NOT NULL,
province VARCHAR,
city VARCHAR,
zip_code VARCHAR,
area_code VARCHAR,
PRIMARY KEY (id)
复制代码

phones表type字段卡类型定义

* 1 移动
* 2 联通
* 3 电信
* 4 电信虚拟运营商
* 5 联通虚拟运营商
* 6 移动虚拟运营商
复制代码

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and

AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and

George F. Luger、William A Stubblefield / Addison Wesley / 2008-09-04 / USD 22.20

This book is designed for three primary purposes. The first is as a programming language component of a general class in Artificial Intelligence. From this viewpoint, the authors see as essential that......一起来看看 《AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and 》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

html转js在线工具
html转js在线工具

html转js在线工具