python if 语句问题 当我用for 循环+ == 可以输出 if的print ,但当将for循环去掉,无论输入什么都会得到第二个print的语句 。

图片说明

回答

你可以这样写

name = input()

names = [ "admin", "nukon", ... ]

if name in names:

print("hello %s, welcome to the system" % name)

else:

print("no such user")

以上是 python if 语句问题 当我用for 循环+ == 可以输出 if的print ,但当将for循环去掉,无论输入什么都会得到第二个print的语句 。 的全部内容, 来源链接: utcz.com/a/47586.html

回到顶部