syntax error in Pyton shell

lion dance_code at hotmail.com
Tue Sep 3 03:04:26 EDT 2002


I'm learning exception handling, I type these code in Python shell:

>>> try: f=open("nofile")
... except IOError: pass
... print "The exception is just passed!"
  File "<stdin>", line 3
    print "The exception is just passed!"
        ^
SyntaxError: invalid syntax

But these code run without any error as a program(or script). Could
anyone tell me why?

Thanks in advance,
lion



More information about the Python-list mailing list