Exception handling syntax: Difference between revisions

Content deleted Content added
[[Python (programming language)|Python]]: <source> … not sure if the leading space is vital here
Line 186:
 
===[[Python (programming language)|Python]]===
<source lang=python>
f = None
try:
f = file("aFileName")
f.write(could_make_error())
except IOError:
print "Unable to open file"
except: # catch all exceptions
print "Unexpected error"
finally: # clean-up actions
if f:
if f:
f.close()
</source>
 
===[[Objective Caml|OCaml]]===