About 413,000 results
Open links in new tab
  1. python - How can I stop a While loop? - Stack Overflow

    I wrote a while loop in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?

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

    Jan 30, 2013 · The condition that causes a while loop to stop iterating should always be clear from the while loop line of code itself without having to look elsewhere. Phil has the "correct" …

  3. Exit while loop in Python - Stack Overflow

    May 21, 2013 · In the code below, I'd like the while loop to exit as soon as a + b + c = 1000. However, testing with print statements shows that it just continues until the for loops are done. …

  4. python - Ending an infinite while loop - Stack Overflow

    Sep 25, 2013 · I currently have code that basically runs an infinite while loop to collect data from users. Constantly updating dictionaries/lists based on the contents of a text file. For reference: …

  5. python - How to stop one or multiple for loop (s) - Stack Overflow

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

  6. Python Leave Loop Early - Stack Overflow

    Sep 29, 2011 · How do I leave a loop early in python? for a in b: if criteria in list1: print "oh no" #Force loop i.e. force next iteration without going on someList.append(a) Also, in ja...

  7. How to stop an infinite loop safely in Python? - Stack Overflow

    Oct 3, 2015 · It is the infinitive python loop in a separate thread with the safe signal ending. Also has thread-blocking sleep step - up to you to keep it, replace for asyncio implementation or …

  8. Exit while loop by user hitting ENTER key - Stack Overflow

    I am a python newbie and have been asked to carry out an exercise: make a program loop until exit is requested by the user hitting <Return> only. So far I have: User = raw_input ('Enter <Ca...

  9. How would I stop a while loop after n amount of time?

    115 how would I stop a while loop after 5 minutes if it does not achieve what I want it to achieve.

  10. How to end a while loop in another Thread? - Stack Overflow

    Sep 8, 2021 · Here's how to fix those things and be able to stop the while loop in the other thread. Instead of a simple boolean variable, it uses an Threading.Event object to control the loop and …