[Tutor] python 2.7.1

Peter Otten __peter__ at web.de
Thu Sep 6 11:10:01 CEST 2012


john wrote:

> print "hello world" #this is just something to say

>>>> /Users/jonathan/Documents/hello.py
>   File "<stdin>", line 1
>     /Users/jonathan/Documents/hello.py
>     ^
> SyntaxError: invalid syntax
> 
> what am i doing wrong?

The >>> prompt indicates that you have already started the interactive 
interpreter by typing

$ python

This is a great way to test Python statements interactively -- type and 
explore Python's response.

However, to run a script you have to provide the script name on the 
commandline

$ python /Users/jonathan/Documents/hello.py




More information about the Tutor mailing list