Based on the answer to this question:
remove last STDOUT line in Python
You can do something like this:
import time
import sys
CURSER_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
def delay_print(sentence, pause_between_words):
for s in sentence.split(" "):
sys.stdout.write( '%s' % s)
sys.stdout.flush()
time.sleep(pause_between_words)
print(ERASE_LINE + CURSER_UP_ONE)
delay_print("Hello World!", 0.5)
This code will print a word at a time in my terminal, remove the last word and print the next. The last word will be deleted just before termination. Is this how you want it to work? Else let me know.
EDIT: Noticed that you also wanted to have a delay between each character print. Have updated my code accordingly.
EDIT: Based on your comment I removed char by char printing.