首页 > 移动平台 > 详细

python 手机号码 邮箱 身份证校验

时间:2021-08-17 10:34:35      阅读:12      评论:0      收藏:0      [点我收藏+]
#手机号码校验
import re
while True:
    iphone = input(‘请输入手机号码:‘).strip()
    res = re.match("1[35678]\d{9}", iphone)
    #res = re.match("1[3-9]\d{9}", iphone)
    if res:
        print(iphone)
        break


#邮箱校验
import re
while True:
    email = input(‘请输入邮箱:‘).strip()
    res = re.match("\w+@\w+\.\w+", email, re.ASCII)
    if res:
        print(email)
        break

#身份证校验
import re
while True:
    text = input(‘请输入身份证号码:‘).strip()
    res = re.findall("\d{17}[\dX]", text)
    if res:
        print(text)
        break

python 手机号码 邮箱 身份证校验

原文:https://www.cnblogs.com/simon1993/p/15150328.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!