About 82,600 results
Open links in new tab
  1. python - How to stop one or multiple for loop (s) - Stack Overflow

    Use break and continue to do this. Breaking nested loops can be done in Python using the following:

  2. python - How can I break out of multiple loops? - Stack Overflow

    From my understanding the question was How to break out of multiple loops in Python? and the answer should have been "It does not work, try something else". I know it fixes the exact given example of …

  3. python - How to exit an if clause - Stack Overflow

    What sorts of methods exist for prematurely exiting an if clause? There are times when I'm writing code and want to put a break statement inside of an if clause, only to remember that those can o...

  4. python - Break or exit out of "with" statement? - Stack Overflow

    This returns but doesn't quite "break out" of a with statement. Users must be aware that the __exit__ is executed regardless with this approach.

  5. Is it possible to break a long line to multiple lines in Python ...

    In Python code, it is permissible to break before or after a binary operator, as long as the convention is consistent locally. For new code Knuth's style (line breaks before the operator) is suggested.

  6. How to break out of while loop in Python? - Stack Overflow

    Jan 30, 2013 · Consider rephrasing "Don't use while True and break statements. It's bad programming." While I try to avoid them as a general rule, many times I have simplified logic structures in a while …

  7. How to break out of nested loops in python? - Stack Overflow

    A break will only break out of the inner-most loop it's inside of. Your first example breaks from the outer loop, the second example only breaks out of the inner loop. To break out of multiple loops you need …

  8. How can I do a line break (line continuation) in Python (split up a ...

    319 From PEP 8 -- Style Guide for Python Code: The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces. Long lines can be …

  9. Is it a bad practice to use break in a for loop? - Stack Overflow

    Is it a bad practice to use break statement inside a for loop? Say, I am searching for an value in an array. Compare inside a for loop and when value is found, break; to exit the for loop. Is thi...

  10. python - How does break work in a for loop? - Stack Overflow

    1 I am new in Python and I got confused about the way that "break" works in a for loop. There is an example in Python documentation (break and continue Statements) which calculates prime numbers …