Is there a command, for example, breakand continuethat can repeat the recent iteration?
For example, when an exception is thrown.
for i in range(0,500):
try:
conn = getConnection(url+str(i))
doSomething(conn)
except:
repeat
Let there be an iteration, where is the ivalue of the variable 6. A connection error occurred during this iteration. I want to repeat this iteration.
Is there a team that can do this?
Of course I can do this:
i=0
while i!=500:
try:
conn = getConnection(url+str(i))
doSomething(conn)
i+=1
except:
pass
source
share