我正在创建一个密码验证系统。但是,我收到了一条错误消息,我不明白错误的原因或位置。我在一个单独的文件上测试了这些单独的验证,它们工作得很好,但是当它们被实现到我的实际程序中时,它似乎不起作用。 这是负责验证的代码。在
#Ensures passwords match and writes the account details to the database
def Checker():
if re.match(user_password2v2, user_passwordv2):
match+=1
else:
match=match
if len(user_namev2) > 5 and len(user_passwordv2)>7:#Ensures the username and passwor are of a minimum length
match+=1
else:
match=match
if re.search(r"\W", user_password2): #Ensures a character is present in the password
match+=1
else:
match=match
if re.search(r'[0-9]', user_weightv2):#Ensures numbers are used in the weight entry
match+=1
else:
match=match
if match==4:
user_information.append(user_namev2)
user_information.append(user_passwordv2)
user_information.append(weight)
Goal_Select()
if match!=4:
Error()
如果不满足这些条件语句中的任何一个,则应运行Error()
。在
user_namev2
、user_passwordv2
和{
“user\u passwordv2”的数据类型似乎不适合
re.search
。下面的代码作为类型转换如何?在
相关问题 更多 >
编程相关推荐