Is it possible to show something like this in Python?
Checking.
Checking..
Checking...
Checking.
I want it to just show one line of this while the script is running, but stop when it's done. The script I want to add it to is here: https://github.com/brandonusher/Python-Scripts/blob/master/check_port.py
Infinite while loop refers to a while loop where the while condition never becomes false. When a condition never becomes false, the program enters the loop and keeps repeating that same block of code over and over again, and the loop never ends.
To break out of a while loop, you can use the endloop, continue, resume, or return statement. endwhile; If the name is empty, the other statements are not executed in that pass through the loop, and the entire loop is closed.
Output the text with no newline character, then flush stdout. Output a \r
to make the cursor go back to the beginning of the line. Repeat until done. Don't forget to overwrite existing text.
while True:
sys.stdout.write('\rfoo. ')
sys.stdout.flush()
delay(100)
sys.stdout.write('\rfoo.. ')
sys.stdout.flush()
delay(100)
sys.stdout.write('\rfoo...')
sys.stdout.flush()
delay(100)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With