print after retry python code example
Example 1: python try then change something and try again if fails
for i in range(0,100):
while True:
try:
# do stuff
except SomeSpecificException:
continue
break
Example 2: python retry
import time
def retry(fun, max_tries=10):
for i in range(max_tries):
try:
time.sleep(0.3)
fun()
break
except Exception:
continue