概述
不需要正则表达式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密码必须至少包含一个大写或小写字母和一个所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复