문제

I have the following code. I want to come out of else block the moment it meets with an exception and I want the for loop to continue. But my code breaks out of the outer for loop as well. Need some help. New to programming.

for (....):
   if (....):
       .....
       .....
   else:
       try:
          ....
       except IndexError:
          break

Thanks

도움이 되었습니까?

해결책

Replace your break with a continue and you should be good to go.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top