I have got the following piece of code, so that while any exception occurs, re-do this loop, instead of jumping to the next loop. Please note the pseudo code here does work as intended:
for cl in range(0, 10):
try:
some_function(cl)
except :
cl -= 1
My initiative was that once something go wrong, do it again. Obviously, this is not a working idea. So given the assumption that the for loop and range function being used, how to implement the control that I described?
Thanks
You simply need a second loop inside the first to continue trying the function until it works: