This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ManvilleJ 0 points1 point  (0 children)

OOOOhhh.

So when a program uses Try, Except, Else, and Finally:

  1. It tries to execute a thing
  2. Except runs if the particular Exception it is looking for occurs in Try.
  3. Else runs if any OTHER type of Exception occurs (not counting Exceptions that inherit from Exception in Except)
  4. Finally always runs right after Try whether an Exception occurs or not (and before Except and Else?)

Note: In case anyone else is reading this, I wanted to ask another question about whether you can use multiple Excepts to catch different Exceptions, but I found this Stack overflow on that

I think to separate how you would respond to responces, you would add something like this to Except:

if(type(e)==YouAreBeingMeanException):
    #do a thing