Python:Control structures

From wiki
Revision as of 23:13, 22 January 2018 by Hdridder (talk | contribs) (Created page with "Category:Python To catch all exceptions (not wise) ==Exception handling== <syntaxhighlight lang=python> try: block except: blockifexceptionisthrown </syntaxhighli...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


To catch all exceptions (not wise)

Exception handling

try:
    block
except:
    blockifexceptionisthrown

You better only catch the exceptions you expect. You can choose from the available exceptions [1]

except NameError
The variable does not exist