I was working on a typing-like effect for printing strings in Python. My code is below:
import time, sys
def type(str):
for letter in(str):
sys.stdout.write(letter)
time.sleep(0.03)
sys.stdout.flush()
print()
And this code works fine, but instead of using os.system('clear')
, I would like the letters to "disappear backwards", sort of like how it prints letter by letter, except I want the string to the disappear letter by letter. Is this possible?