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