Python | 为什么Python报SyntaxError: Missing parentheses in call to ‘print’?错误

导读:

今天你学什么了↓

1、问题

为什么输入命令print Hello World 报SyntaxError: Missing parentheses in call to print . Did you mean print( hello world‘)错 ?

操作步骤:

  • ① 在命令提示符界面,输入Python,回车,进入启动解释器,
  • ② 但在以下不同入口输入命令:print Hello World ,按 Enter 键或回车键,并没有输出单词 “Hello World”,而是报错:
    SyntaxError: Missing parentheses in call to print . Did you mean print( hello world‘)?

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

2、解决方案

原来,我的Python版本是3.8.5,使用的是Python 3,输入的格式在 Python 3 中不识别,所以修改格式为:
print (“hello world”) ,即可成功,如下图:

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

Python | 为什么Python报SyntaxError: Missing parentheses in call to  print ?错误

End by 艾兜兜儿
→ 今天你学什么了,2021.04.20

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
闻闻橘子汽水的头像 - 鹿快
评论 抢沙发

请登录后发表评论

    暂无评论内容