#手机号码测试:
def number_test():
while True:
number = input('Please enter your phone number:')
CN_mobile = [134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705]
CN_union = [130, 131, 132, 155, 156, 185, 186, 145, 176, 1709]
CN_dianxin = [133,153,180,181,189,177,1700]
first_three = int(number[0:3])
first_four = int(number[0:4])
if len(number) == 11:
if first_three in CN_mobile or first_four in CN_mobile:
print ('Operator: China Mobile!')
print ('we are sending message code to you phone',number)
break
elif first_three in CN_union or first_four in CN_union:
print ('Operator: China Union!')
print ('we are sending message code to you phone',number)
break
elif first_three in CN_dianxin or first_four in CN_dianxin:
print('Operator: China Dianxin!')
print('we are sending message code to you phone', number)
break
else:
print ('invalid input number!')
else:
print ('invalid numbers,You number should be 11th')
number_test()

测试结果如下: 

 

python手机号码运营商归属测试的更多相关文章

  1. Python(phone)模块获取手机号归属地、区号、运营商等

    Python(phone)模块获取手机号归属地.区号.运营商等 一.我使用的是python3,可以自行搜索下载 二.安装phone模块, pip install phone 三.测试代码如下: fro ...

  2. python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码

    python3.4学习笔记(二十三) Python调用淘宝IP库获取IP归属地返回省市运营商实例代码 淘宝IP地址库 http://ip.taobao.com/目前提供的服务包括:1. 根据用户提供的 ...

  3. Python查找电话号码归属地、邮编、运营商信息等

    # -*- coding: utf-8 -*- 1. 查找单个电话号码 from phone import Phone def get_phone_info(phone_num): phone_inf ...

  4. PHP 判断手机号归属地 和 运营商的免费接口

    在项目开发的时候,需要去查询又一批手机号或者固话的具体信息(归属地 运营商) 就需要写一个脚本,来批量请求接口来得到我们想要的数据 学习源头:https://blog.csdn.net/shaerdo ...

  5. sipp模拟电信运营商VoIP终端测试(SIP协议调试)

    三大运营商都有SIP服务器,用来支持语音对讲,多媒体调度等功能,他们的平台可能不是标准的SIP协议会话. 为了应对没完没了的对接各个厂商的平台,这里再整理了一套协议脚本,毕竟全都是没有意义的无用功,标 ...

  6. WordPress显示评论者IP归属地、浏览器、终端设备、电信运营商

    在网上查资料闲逛,偶然间看到了张戈博客的评论框有点意思,于是就收走拿到了我的米扑博客. 本文为米扑博客原创:总结分享 WordPress显示评论者IP归属地.浏览器.终端设备.电信运营商 WordPr ...

  7. Unity获取安卓手机运营商,电量,wifi信号强度,本地Toast,获取已安装apk,调用第三方应用,强制自动重启本应用

    一个完整的游戏项目上线需要不断的完善优化,但是到了后期的开发不再仅仅是游戏了,它的复杂度远远大于纯粹的应用开发.首先必须要考虑的就是集成第三方SDK,支付这块渠道商已经帮你我们做好了,只需要按照文档对 ...

  8. PHP判断手机号运营商(详细介绍附代码)

    道理很简单,知道手机号规则 进行正则判断就可以 移动:134.135.136.137.138.139.150.151.157(TD).158.159.187.188 联通:130.131.132.15 ...

  9. Java ip地址查询,根据ip接口获得ip所在省市区,邮编,运营商等

    早上一来,项目经理就说需要添加一个用户ip归属地查询功能,然后在网上搜罗半天,研究出一个比较简单的方法,通过接口返回地址json数据 有百度接口,新浪接口,这里用的是淘宝ip接口 通过淘宝IP地址库获 ...

随机推荐

  1. R语言数据分析

    CSDN博客:包括R语言基础.R语言数据挖掘.hadoop大数据及spark等 http://blog.csdn.net/qq_16365849 R语言及数据分析 http://blog.csdn.n ...

  2. cocos2dx调度器scheduler

    / 让帧循环调用this->update(float dt)函数 // scheduleUpdate(); // 让帧循环去调用制定的函数,时间还是1/60秒 // schedule(sched ...

  3. 《C和指针》章节后编程练习解答参考——6.2

    <C和指针>——6.2 题目: 编写一个函数,删除源字符串中含有的子字符串部分. 函数原型: int del_substr(char *str, char const *substr); ...

  4. java枚举小结

    如何定义一个枚举类? //定义了4个等级 enum Level{ A,B,C,D } 枚举类的实质: class Level{ public static final Level A = new Le ...

  5. 关于存储的--b

    iphone沙箱模型的有四个文件夹,分别是什么,永久数据存储一般放在什么位置,得到模拟器的路径的简单方式是什么. documents,tmp,app,Library. (NSHomeDirectory ...

  6. Mosquitto-MQTT

    安装Mosquitto #To use the new repository you should first import the repository package signing key: w ...

  7. jQuery Ajax 分页插件

    很多社交网站都使用无限滚动的翻页技术来提高用户体验,当你页面滑到列表底部时候无需点击就自动加载更多的内容 很多社交网站都使用无限滚动的翻页技术来提高用户体验,当你页面滑到列表底部时候无需点击就自动加载 ...

  8. mangos搭建

    github地址:https://github.com/mangos/MaNGOS MaNGOS 是( Massive Network Game Object Server) 的缩写.由于暴雪公司对类 ...

  9. 【HDOJ】3242 List Operations

    注意以下数据:[] ++ [][] -- [1,2][1,2] ++ [][] ++ [1][2] ++ [][2,3] -- []结果是[][][1,2][1][2][2,3] /* 3242 */ ...

  10. C 函数原型

    int add(int,int);//add two int numbers and return it--- add function prototype; int main(int argc, c ...