Python: for-else with break

Yao Yao on September 28, 2017

Python Tips: 19. For - Else:

The else clause executes when the loop completes normally. This means that the loop did not encounter any break.

In addition, if an exception is raised in for without handling, else after this for won’t execute.

blog comments powered by Disqus