1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 03:50:32 +02:00

Update python.html.markdown

Added more details to try/except section.
This commit is contained in:
Shashwat986
2014-08-02 19:37:28 +05:30
parent 10c07f30d5
commit e6a289be49

View File

@@ -334,6 +334,10 @@ try:
raise IndexError("This is an index error")
except IndexError as e:
pass # Pass is just a no-op. Usually you would do recovery here.
except (TypeError, NameError):
pass # Multiple exceptions can be handled together, if required.
else: # Optional clause to the try/except block. Must follow all except blocks
print "All good!" # Runs only if the code in try raises no exceptions
####################################################