python编程快速上手 第七章实践项目答案 欢迎交流
import re
def check():
while True:
print('Please input key')
x = input()
pw1 = re.compile(r'[a-z]+')
pw2 = re.compile(r'[A-Z]+')
pw3 = re.compile(r'[0-9]+')
if pw1.search(x) is None:
print('请输入至少一个小写字母')
continue
if pw2.search(x) is None:
print('请输入至少一个大写字母')
continue
if pw3.search(x) is None:
print('请输入至少一个数字')
continue
if len(x) < 8:
print('密码长度需大于8')
continue
if (len(x)>=8)and(pw1.search(x) is not None)and( pw2.search(x) is not None)and(pw3.search(x) is not None):
print('符合')
break
check()