I was wondering, why does this Python code not print anything in my console?
from time import sleep
while True:
print('#', end='')
sleep(1)
If I remove the sleep
function it works, and if I remove the end=''
part it works too. I am using Python 3.9 and I have tested this with Dash, Bash and ZSH. I can achieve the desired output with the following code.
from time import sleep
hash = '#'
while True:
print('\r' + hash, end='')
hash = hash + '#'
sleep(1)
Thank you in advance.