Python中手动写判断电话号码



#判断是不是电话号码

def checkPhone(str):
if len(str) !=11:
return False
elif str[0]!="1":
return False
#elif str

for i in str:
if i>="0" or i<="9":
return True

return False
print(checkPhone("13135354568"))
print(checkPhone("23135354568"))

猜你喜欢

转载自www.cnblogs.com/zlong123/p/10514951.html