#手机号码校验
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