+ 2
How do I use continue in a for loop inside a while loop?
This is an example of my code: while something: functions if something: try: functions if something: try: for x in range(something): if something: functions continue except something: functions It give me an IndentationError! What can I do to avoid it? How can I use continue to restart the while loop and not the for loop?
1 Antwort
+ 9
class Continue(Exception): pass
for i in range(5):
try:
for j in range(5):
print('j')
if j==3: raise Continue
except Continue:
continue
print('i')