Use the print to print character by character and Sleep to create a pause between each character.
In that case to print
the argument is passed ''
for the parameter end
meaning that at the end of the print a line will not be skipped.
For the parameter flush
the argument is passed True
because print uses an output buffer and parameter flush
indicates that this buffer should be dumped or not after calling the command and a value True
indicates that yes should be dumped. If not done so the printing would only be done after the completion of the loop containing the instruction,
import time
def slowprint(texto, atraso=0.2):
for c in texto:
print(c,end='',flush=True)
time.sleep(atraso)
slowprint('E lá vamos nós')
Test the code in the Repl.it: https://repl.it/repls/UnitedQuestionableAdministration
Can’t you go printing one character at a time? Giving a Sleep between these prints.
– G. Bittencourt
It would be impractical if he had to use this more often during the program, and also if the character size were in large numbers, imagine how many Sleep he wouldn’t need. The comic would get very messy and messy.
– user187043
I tested here and apparently not possible, can not do that you are trying. Only one line at a time.
– G. Bittencourt
@G.Bittencourt, at a glance https://answall.com/a/448808/137387
– Augusto Vasques