0
我遇到了麻煩,因爲我的Python3代碼的語法很好。我剛剛在我的Mac 10.6.8上下載了python 3.3.2。Mac上Python第1行的語法錯誤:python 3.3.2
這是我在IDLE中的代碼,然後是我的TERMINAL錯誤消息。當我通過IDLE運行程序時,語法錯誤消息突出顯示了python 3.3.2中的第二個「3」。到底是怎麼回事??
IDLE:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 12:45:22)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> print("Hello")
Hello
>>>
TERMINAL錯誤消息:
File "hello.py", line 1
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 12:45:22)
^
SyntaxError: invalid syntax
你不應該有垃圾在開始你的文件;它是由Python在開始運行時生成的。只需從'Print(「hello」)'行開始作爲第一行。 – Floris