python校验各国手机号格式是否正确
下载库 phonenumbers
def verify_phone_number(phone_number: str) -> (bool, int):
"""
校验各国手机号格式
"""
z = phonenumbers.parse(phone_number)
return phonenumbers.is_valid_number(z), z.national_number
if __name__ == '__main__':
print(verify_phone_number('+8618888888888'))