On Mon, Mar 21, 2011 at 1:58 AM, sihong lin <span dir="ltr"><<a href="mailto:linsihong2003@yahoo.com">linsihong2003@yahoo.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">Hi, <br><br> I just write a simplest file test.py with only one line--print "hello", when I run it in command line:<br>
>>> python test.py<br><br>the follow message comes out:<br><br><span style="color: rgb(255, 0, 255);">File "<stdin>" , line 1</span><br style="color: rgb(255, 0, 255);"><span style="color: rgb(255, 0, 255);"> python test</span><br style="color: rgb(255, 0, 255);">
<br style="color: rgb(255, 0, 255);"><span style="color: rgb(255, 0, 255);">SyntaxError: invalid syntax</span><br style="color: rgb(255, 0, 255);"><br>but, the file can run in shell, also in the command line, I put<br><br>
>>> print "hello"<br><br>output is fine, "Hello"<br></td></tr></tbody></table></blockquote><div><br>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. <br>
</div></div><br clear="all"><br>-- <br>André Engels, <a href="mailto:andreengels@gmail.com">andreengels@gmail.com</a><br><br>