有没有办法为一个输入框指定多个变量Python

2024-04-29 20:18:40 发布

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

如何将多个变量分配给一个GUI输入框?像这样:q1,q2,q3=input()

代码不是这样的,但我希望它是这样的:

 a, b, c = str(input("Type in a command"))

但不是这样的:

abc = str(input("Type in a command"))

if abc == str("a"):
    print ("a is right")
else:
    print ("a is wrong")

if abc == str("b"):
    print ("b is right")
else:
    print ("b is wrong")

if abc == str("c"):
    print ("c is right")
else:
    print ("c is wrong")

如果我这样做,我会弄错其中一个,它会告诉我一个是对的,两个是错的。(a错了,b对了,c错了)


Tags: inrightinputifistypeguielse