個人博客 地址:http://www.wenhaofan.com/article/20180618180327
>>> print "hello" SyntaxError: Missing parentheses in call to 'print'
在環境搭建章節中的路徑下載了最新的Python安裝包並完成安裝后,在cmd窗口執行菜鳥教程第一個 Python 程序中的代碼:print "Hello, Python!";提示“>>> print "hello" SyntaxError: Missing parentheses in call to 'print'” 。
原因為該教程實例基於python2.7版本,但是python官網最新的版本已經為3.x。而在python3.x中已經取消了print語句,加入了print()函數來執行輸出。
所以在3.x版本中打印Hello,Python應該由print “Hello,Python”; 修改為 print (“Hello,Python”);