Suggest a cleaner way to handle Python exceptions?
I have the following code where there is repetitive clean up involved.
try:
#some code here
except ValueError , e :
cleanup_p()
cleanup_q()
handle_ValueError()
except IOError , e :
cleanup_m()
cleanup_n()
handle_IOError()
Is there an elegant way of handling repetitive clean-ups in exception handling?