I want to store some data in a web. I want to do two operations: the first is to open a URL, the second is to store data, with both of them in try...except
blocks.
I'd like to know if nesting try...except
is good or not, and why.
Solution one:
try:
# open url
# store data
except:
# url doesn't exist
# cannot store
Solution two:
try:
# open url
try:
# store data
except:
# cannot store
except:
# cannot open url