不需要正则表达式import string
import sys
NON_ALPHABETIC_CHARACTERS = {'#', '@', '%'}
DIGITS_CHARACTERS = set(string.digits)
LETTERS_CHARACTERS = set(string.ascii_letters)
def validate_password_1(password,
non_alphabetic_characters=NON_ALPHABETIC_CHARACTERS,
digits_characters=DIGITS_CHARACTERS,
letters_characters=LETTERS_CHARACTERS):
if not any(character in password
for character in non_alphabetic_characters):
err_msg = ('Password should contain at least '
'one non-alphabetic character.')
print(err_msg)
print('Invalid password!')
sys.exit()
if not any(character in password
for character in digits_characters):
err_msg = ('Password should contain at least '
'one digit character.')
print(
最后
以上就是慈祥小刺猬最近收集整理的关于python同时含有大写小写_python密码必须至少包含一个大写或小写字母和一个的全部内容,更多相关python同时含有大写小写_python密码必须至少包含一个大写或小写字母和一个内容请搜索靠谱客的其他文章。
发表评论 取消回复