Skip to main content

Posts

Showing posts from March, 2012

Break out of more than 2 loops in python

If you want to break out of a loop in Python, just use "break". How about when you need to bread out of more than 2 loops in Python? Here is a hint: Using Raise and Exception. try:    ...    if (condition) : #You want to break your loop here       raise GetOutOfLoop except GetOutOfLoop:    pass