Console run's slow when using sleep with print(flush=True)
已回答
from time import sleep
for char in "Hello World. This is a test":
print(char, end="", flush=True)
sleep(0.05)
The output is laggy and print's 4 char's per half seconds
Output:
-Hell
-Hello Wo
-Hello World.
-Hello World. Thi
-Hello World. This is
-Hello World. This is a t
-Hello World. This is a test
How to fix it?
请先登录再写评论。
Hi! Yes, such optimization is used in our GUI, to make it faster. Unfortunately, you can't do anything with that at the moment. Feel free to submit your feature request to our bug tracker: https://youtrack.jetbrains.com/issues/PY