密码需要符合下面的要求:
8个字符以上,包含数字,大小写,开头不能为特殊字符。
#! /usr/bin/python
import re
password = str(input())
def lenOK(pwd):
if(len(pwd)>=8):
return True
else:
print("WARNING: The password should be at least 8 characters.")
return False
def numberOK(pwd):
pattern = re.compile('[0-9]+')
match = pattern.findall(pwd)
if match:
return True
else:
print("WARNING: The password should include at least 1 number.")
return False
def upperOK(pwd):
pattern = re.compile('[A-Z]+')
match = pattern.findall(pwd)
if match:
return True
else:
print("WARNING: The password should include at least 1 upper character.")
return False
def lowerOK(pwd):
最后
以上就是美好音响最近收集整理的关于用python编写密码验证程序_用python实现密码校验程序的全部内容,更多相关用python编写密码验证程序_用python实现密码校验程序内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复