python 判断手机号是否正确

import re
def judge_Monile_phone(phone):
    phone='14737373737'
    if len(phone)==11:
        rp=re.compile('^0\d{2,3}\d{7,8}$|^1[358]\d{9}$|^147\d{8}')
        phoneMatch = rp.match(phone)
        if phoneMatch:##判断成功
            print(phoneMatch.group())
        else:
            print("phone number is error!")
    else:
        print("phone number length is error!")

猜你喜欢

转载自blog.csdn.net/yangczcsdn/article/details/81296393