In my program, I use lots of blocks like this:
while True:
try:
DO_SOMETHING()
break
except:
pass
Such that I can "keep trying until success". But this seems not Pythonic. Is there any elegant way to do this?
In my program, I use lots of blocks like this:
while True:
try:
DO_SOMETHING()
break
except:
pass
Such that I can "keep trying until success". But this seems not Pythonic. Is there any elegant way to do this?