def judge_password(password): if len(password) >= 8: pattern = re.compile('[A-Z]+') match = pattern.findall(password) if match: pattern = re.compile('[a-z]+') match = pattern.findall(password) if match: pattern = re.compile('[0-9]+') match = pattern.findall(password) if match: return 'True' else: return '必须包含数字' else: return '必须包含小写字母' else: return '必须包含大写字母' else: return '长度必须大于8位'