diff options
author | Shashwat986 <chandra.shashwat@gmail.com> | 2014-08-02 19:37:28 +0530 |
---|---|---|
committer | Shashwat986 <chandra.shashwat@gmail.com> | 2014-08-02 19:37:28 +0530 |
commit | e6a289be491c9b0f1a7c2d5b364de0c4c8241bd9 (patch) | |
tree | d51332b96f51bdd92b64f635642f5e0797b6a811 | |
parent | 10c07f30d50d9cda4b2ad193b212581c0b32152f (diff) |
Update python.html.markdown
Added more details to try/except section.
-rw-r--r-- | python.html.markdown | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/python.html.markdown b/python.html.markdown index aa077e57..5bec5190 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -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 #################################################### |