python idle 3.4.0“print”语法

2024-06-14 18:10:35 发布

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

python空闲向print()函数抛出一个错误,我不知道为什么会出现代码。。在

password = "cow"
name = input()
input("MR PENGUIN: hello there i am Mr Penguin  what is your name?  ")
input("well, hello there"+name+"Tell me your password")
input("You: my password is, ")
input("MR PENGUIN: im little defh could you repeat that? ")
input("YOU: my password is, "
print("PC POLICE: STOP! dont ever trust penguins with your data becuase he just told every                               one that your password is "+ password) 
input("Press Enter To Exit")

Tags: 函数namehelloinputyourthatismy
2条回答

这是因为上一行中的input语句缺少一个结束的妄想。在

它应该是:

input("YOU: my password is, ")

而不是

^{pr2}$

上一行的input末尾缺少一个括号。在

更改:

input("YOU: my password is, "

收件人:

^{pr2}$

你的print还行。请注意,当您得到一个神秘的错误时,它通常是在上一行上的内容。在

相关问题 更多 >