About 112,000 results
Open links in new tab
  1. Are infinite for loops possible in Python? - Stack Overflow

    While there have been many answers with nice examples of how an infinite for loop can be done, none have answered why (it wasn't asked, though, but still...) A for loop in Python is syntactic …

  2. loops - Looping from 1 to infinity in Python - Stack Overflow

    Jun 27, 2014 · If you're doing that in C, then your judgement there is as cloudy as it would be in Python :-) For a loop that exits on a simple condition check at the start of each iteration, it's …

  3. Infinite loops using 'for' in Python - Stack Overflow

    Jan 11, 2018 · Why does this not create an infinite loop? a=5 for i in range(1,a): print(i) a=a+1 or this. for i in range(1,4): print(i) i=i-1 or this. for i in range(1,4): print(i) i=1 Is there any way we …

  4. How do I make an infinite for loop in Python (without using a …

    Apr 29, 2016 · @joelgoldstick, i m making slides for high schools about python, i made one about while infinite loop and got curious - is there way to do infinite loop in python, so that's why …

  5. python - How to write an infinite loop that an exception can't …

    I can easily break out of the loop with Ctrl-C while Python is executing slow_true(). Even if I replace while slow_true(): with while True: there is theoretically a small window of time …

  6. python - How to run a script forever? - Stack Overflow

    Yes, you can use a while True: loop that never breaks to run Python code continually. However, you will need to put the code you want to run continually inside the loop: #!/usr/bin/python …

  7. How can I infinitely loop an iterator in Python, via a generator or ...

    Here is working python code that demonstrates the exact example behavior I desire: def loop_list(iterable): """ Return a Generator that will infinitely repeat the given iterable. >>> l = …

  8. 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 …

  9. python - Easy way to keep counting up infinitely - Stack Overflow

    Jul 11, 2012 · would generate an infinite sequence starting with 13, in steps of +1. And, I hadn't tried this before, but you can count down too of course: for i in itertools.count(100, -5): print(i) …

  10. Print numbers from 1 to x where x is infinity in python

    Dec 18, 2012 · I have a question regarding Python where you code a simple script that prints a sequence of numbers from 1 to x where x is infinity. That means, " x " can be any value. For …

Refresh