【问题标题】:python idle 3.4.0 'print' syntax error [closed]python idle 3.4.0'print'语法错误[关闭]
【发布时间】:2014-04-14 13:29:38
【问题描述】:

python idle 在 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")

【问题讨论】:

  • 哦,拜托。您在上一行中缺少右括号..
  • @thefourtheye:这对于新手来说总是令人惊讶的事情;您需要查看上一行的错误。

标签: python macos printing syntax-error


【解决方案1】:

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

变化:

input("YOU: my password is, "

到:

input("YOU: my password is, ")

作为记录,您的print 很好。请注意,当您遇到神秘错误时,通常是在上一行中。

【讨论】:

    【解决方案2】:

    这是因为您在上一行中的 input 语句缺少右括号。

    应该是:

    input("YOU: my password is, ")
    

    而不是

    input("YOU: my password is, "
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-23
      • 1970-01-01
      • 2012-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多