try: func() except: print("retrying") x = 0 while x == 0: try: func() x +=1 except: pass
finished = False while not finished: ... do something... finished = evaluate_end_condition()