syntax error in Pyton shell

Dennis Lee Bieber wlfraed at ix.netcom.com
Tue Sep 3 03:40:08 EDT 2002


lion fed this fish to the penguins on Tuesday 03 September 2002 12:04 
am:

> 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?

        Off hand... Your indentation is invalid... You need to return to the 
>>> level for the print

-- 
--
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <



More information about the Python-list mailing list