Repeat Index Of Loop

Viewed 178

How can I repeat an index of a for loop?

for path in directory:
   
   ...
   
   if ...:
      stop here and
      repeat the current index of the for loop
   ...

I would call it a restart ^^

1 Answers
for path in directory:
   X
   if C:
      stop here and
      repeat the current index of the for loop
   Y

becomes

for path in directory:
   while True:
      X
      if not C:
         break
   Y
Related