Reputation: 45
Is there a way to repeat a loop with same iterator without i
incrementing by 1?
for i in range(100):
random_function()
if status_code != 200:
#repeat function with same iterator without incrementing by 1.
Upvotes: 1
Views: 1166
Reputation: 191701
Use a while loop and control the increment yourself
i = 0
while i < 100:
foo()
if status == 200:
i += 1
Or build the retry logic into your "random function"
Upvotes: 3