开发者

Why is Python 3.1.3 in the header listed as a syntax error?

I'm a newbie programmer so I'll do my best to clearly ask my question. I'm running Python scripts in Mac 10.6.5 and now trying to write and save to a text file (following instructions in开发者_如何学运维 HeadsUp Python book). Whenever I hit function+F5 (as instructed) I get the same "invalid syntax" error and Idle highlights the "1" in "Python 3.1.3" of the header. Here's the header to which I'm referring:

Python 3.1.3 (r313:86882M, Nov 30 2010, 09:55:56) [GCC 4.0.1 (Apple Inc. build 5494)] on darwin Type "copyright", "credits" or "license()" for more information.

Extremely frustrating. I've checked and rechecked the code but this doesn't seem to be code related because the "syntax error" is in regards to the header text that posts in every Idle/Python session. Help anyone?


... and Idle highlights the "1" in "Python 3.1.3" of the header ...

Standalone Python scripts used to contain a "header", but that would be just

#!/usr/bin/env python

or, depending on the name of the interpreter maybe

#!/usr/bin/env python3.1

Not sure I understand your question, though.


you are writing your script in the wrong IDLE window ! when starting IDLE, it opens 2 windows: one for writing a script and another one with an interactive python shell. executing the content of the interactive python shell makes no sense.


@squashua: I have the same issue when I try to run the code either in IDLE or Ubuntu terminal. Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25)

it highlights "5" as syntax error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜