Python 有人能帮我解决这个错误吗

Python 有人能帮我解决这个错误吗,python,if-statement,split,Python,If Statement,Split,这是我的代码,用python 2.7.13版编写: import random num=random.sample(range(1,9),4) print(num) thing=1 while thing==1: while thing==1: Usernum=str(input("Input a number of four DIFFRENT digits all of which are between 1 and 9 or exit")) if Us

这是我的代码,用python 2.7.13版编写:

import random
num=random.sample(range(1,9),4)
print(num)
thing=1
while thing==1:
    while thing==1:
        Usernum=str(input("Input a number of four DIFFRENT digits all of which are between 1 and 9 or exit"))
        if Usernum = "exit":
            print("Goodbye")
            break
        else:
            pass
        if len(set(Usernum)) == 4:
            pass
        else:
            print("You enterd a number that wasn't 4 digits, please try again!")
            thing==1
            pass

        if Usernum.isdigit:
            pass
        else:
            print("you entered something that isnt a number, please try again!")
            pass
        num1,num2,num3,num4 = Usernum.split() 
        if num1 in (num2,num3,nub4) or num2 in (num3,num4) or num3==num4:
            print("you ented a number with duplicate digits, Please try again!")
        else:
            break
else:
pass
在我得到一个我从未见过的错误之前。它说:

“ValueError:需要多个值才能解包”


你需要仔细检查你的等式。在python和许多其他语言中,double equals
=
是一种逻辑测试。单个
=
是一个赋值。通过您的代码再次检查这一点


同样在最后一行,你没有正确缩进你的通行证,但由于你在其他地方都有这个权利,我想这是因为你还没有完成。希望这有帮助。

在第26行,您希望测试num3和num4之间的相等性,如下所示:

num3==num4

注意在变量名和运算符之间使用空格,并使用双等于。

此处
if Usernum=“exit”:
代码中有许多错误。