TypeError:应为字符串或类字节对象python

2024-09-28 17:20:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在创建一个密码验证系统。但是,我收到了一条错误消息,我不明白错误的原因或位置。我在一个单独的文件上测试了这些单独的验证,它们工作得很好,但是当它们被实现到我的实际程序中时,它似乎不起作用。 这是负责验证的代码。在

#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_namev2user_passwordv2和{}都是从tkinter输入框中提取的变量。在

这是我整个错误信息的截图。 enter image description here


Tags: andtherelenifinformationmatch错误