[Tutor] Interactive only syntaxerror?
orbitz
orbitz at ezabel.com
Sat Oct 30 16:43:49 CEST 2004
you have to hit enter again to let the interactive interpreter know you
are done with that scope, that is why there are ...
You want >>>
bob at nc.rr.com wrote:
>Given the following file - test.py:
>----------------------------------
>if 1:
> print "True"
>print "Done"
>----------------------------------
>Invoking python at the command prompt works, as expected:
>----------------------------------
>C:\Python>python test.py
>True
>Done
>
>C:\Python>python <test.py
>True
>Done
>----------------------------------
>Why does this fail with a SyntaxError?
>----------------------------------
>C:\Python>python
>Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>
>
>>>>if 1:
>>>>
>>>>
>... print "True"
>... print "Done"
> File "<stdin>", line 3
> print "Done"
> ^
>SyntaxError: invalid syntax
>
>
>----------------------------------
>Thanks
>Bob
>
>
>_______________________________________________
>Tutor maillist - Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
More information about the Tutor
mailing list