On Mon, Mar 21, 2011 at 1:58 AM, sihong lin <[email protected]> wrote:

> Hi,
>
>  I just write a simplest file test.py with only one line--print "hello",
> when I run it in command line:
> >>> python test.py
>
> the follow message comes out:
>
> File "<stdin>" , line 1
>  python test
>
> SyntaxError: invalid syntax
>
> but, the file can run in shell, also in the command line, I put
>
> >>> print "hello"
>
> output is fine, "Hello"
>

In the shell you can run shell commands, in the Python command line you can
run Python code. "python test.py" is a shell command, not Python code, so
you can run it in the shell, but not on the Python command line. "print
"hello"" is Python code, so you can run it on the Python command line, but
not in the shell.


-- 
AndrĂ© Engels, [email protected]
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to