[Tutor] general exception questions

richard kappler richkappler at gmail.com
Mon Oct 5 19:46:52 CEST 2015


I'm reading up on exception handling, and am a little confused. If you have
an exception that just has 'pass' in it, for example in a 'for line in
file:' iteration, what happens? Does the program just go to the next line?

EX:

for line in file:
    try:
        do something
    except:
        pass

I know (so many of you have told me :-) that using pass is a bad idea, but
how else do you skip the current line if the 'try' can't be done, and go on
to the next line exiting the program with a trace error?

regards, Richard


More information about the Tutor mailing list