| Store | Cart

Re: [Tutor] what is it mean--- File "<stdin>", line 1

From: Andre Engels <andr...@gmail.com>
Mon, 21 Mar 2011 06:27:42 +0100
On Mon, Mar 21, 2011 at 1:58 AM, sihong lin <lins...@yahoo.com> 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, andr...@gmail.com

_______________________________________________
Tutor maillist  -  Tut...@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Recent Messages in this Thread
sihong lin Mar 21, 2011 12:58 am
Corey Richardson Mar 21, 2011 01:14 am
Andre Engels Mar 21, 2011 05:27 am
Messages in this thread