python手机号码标记_python 判断号码是否可用(号码过滤)
def delCustomer(customer): # 返回两个 第一个用来标记是否可用,第二个标记号码
f = open(AbnormalPhone,"r")
src = f.readlines()
f.close()
abnormalSet = set()
for line in src:
phone = str(line.split("\n")[0].strip())
abnormalSet.add(phone)
matchObj = re.match('0?1[3-9]\d{9}$', customer)
if (matchObj!=None): # 如果是手机号
if len(customer) == 11:
return 1,customer
elif len(customer) == 12:
return 1,customer[1:]
else: #如果不是手机号
matchObj = re.match('0(10|2\d)', customer) # 区号是3位 customer[0:3], customer[3:] 区号,号码
if (matchObj != None):
if (len(customer[3:]) == 7 or len(customer[3:]) == 8) and customer not in abnormalSet:
return 1,customer
else:
return 0,customer
matchObj = re.match('0([3-9]\d{2})', customer) # 区号是4位 customer[0:4], customer[4:] 区号,号码
if (matchObj != None):
if (len(customer[4:]) == 7 or len(customer[4:]) == 8) and customer not in abnormalSet:
return 1,customer
else:
return 0, customer
if (len(customer) == 7 or len(customer) == 8) and customer not in abnormalSet:
return 1,customer
else:
return 0,customer
python手机号码标记_python 判断号码是否可用(号码过滤)相关推荐
- python 判断号码是否可用(号码过滤)
def delCustomer(customer): # 返回两个 第一个用来标记是否可用,第二个标记号码f = open(AbnormalPhone,"r")src = f.re ...
- python即时标记_python基础教程总结15——1.即时标记
1. 测试文档: #test_input.txt Welcome to World Wide Spam. Inc. These are the corporate web pages of*World ...
- python telnet 交互_Python判断telnet通不通的实例
这个跟ping那个差不多,ping的那个脚本就是通过这个改了下,大体一致,不过telnet的不需要判断返回的字符串.快一些 这里具体需要telnet的ip是需要自己向定义好的数组中写的 我这里加了一个 ...
- python合法的字符串_Python判断字符串是否为合法标示符操作
这学期在学习编译原理,最近的上机作业就是做一个简单的词法分析器,在做的过程中,突然有个需求就是判断一个字符串是否为合法的标示符,因为我是用python语言做的,做的是Python的词法分析器,于是下面 ...
- python循环体结束标志_python判断循环体结束的方法
python如何判断循环体结束? 相关推荐:<python视频> Python break语句,就像在C语言中,打破了最小封闭for或while循环. break语句用来终止循环语句,即循 ...
- python输出偶数_Python 判断奇数偶数的方法
Python 判断奇数偶数的方法 以下实例用于判断一个数字是否为奇数或偶数: # -*- coding: UTF-8 -*- # Filename : test.py # Python 判断奇数偶数 ...
- python图像数独_Python判断有效的数独算法示例
本文实例讲述了Python判断有效的数独算法.分享给大家供大家参考,具体如下: 一.题目 判断一个 9x9 的数独是否有效.只需要根据以下规则,验证已经填入的数字是否有效即可. 1. 数字 1-9 在 ...
- python奇偶求和_python 判断奇偶并求和,运行过程有错误,希望高手给指导一下。...
问题是:b) Add to the condition in the while loop so that it will stop if either the user inputs a zero ...
- python股票交易时间_python 判断是否股市交易日
import tushare as ts ts.trade_cal() isOpen为1就是开市. 全部源码如下: import tushare as ts import datetime impor ...
最新文章
- Fragment的setUserVisibleHint方法实现懒加载
- 云计算之路-阿里云上:消灭“黑色n秒”第一招——不让CPU空闲
- python2安装pyyaml_Python3安装Pyyaml
- 如何在博客等文章中添加带有滚动条的文本框
- openlayer调用geoserver发布的地图实现地图的基本功能
- leetcode 456. 132 模式(单调栈)
- 各大公司官网都有哪些显而易见的Bug?
- solr5.5.3+tomcat8部署
- IIS6配置后仍然无法解析json文件解决办法
- 相机标定:机器人手眼标定全解析
- 计算机科学考研难不难,计算机考研有多难
- 微软服务器dda,Windows 10 版本2004 微软官方原版镜像
- Caused by: java.lang.ClassNotFoundException: org.springframework.scheduling.quartz.CronTriggerBean
- 人脸检测-ROI与泛洪填充(5)
- YOLO算法创新改进系列项目汇总(入门级教程指南)
- DataFrame的apply应用
- subsequent settlement in SD
- php将文字转为拼音,php 将汉字转化成拼音
- 馈线自动化终端(FTU)
- (一)python-申请评分卡模型