I have a loop in python that is sleeping 0.1 seconds every iteration. It is sequentially printing out a string to the console. I want it to add a character every iteration, But the problem is that it waits until the loop is finished to display the text. This only happens when I have the ", end='' " bit at the end of the print call.
import time def speak(text): i = 0 for i in range(0, len(text) + 1): print(text[i], end='') i += 1 time.sleep(0.1) speak("Test 123. Can you see me?")
printfunction to get it to print immediately:print(text[i], end='', flush=True)