I tried to make a function which can "spit out" given string, character by character. It works the way it should, except for one part. The way it's supposed to work includes clearing the console, yet it doesn't want to work. I tried various methods, like using os module to call "cls" command, yet it didn't help. After i compile the code and try to run it in a windows console, not a single character shows.
import os
from time import sleep
def text_function(text):
def clear():
os.system("cls")
def length(to_measure):
true_length = len(to_measure)
return true_length
text_length = length(text)
separated = list(text)
already_printed = []
already_printed.append(" ")
number = 0
while True:
already_printed.append(separated[number])
sleep(0.15)
print(*already_printed, end="")
print("|", end="")
sleep(0.15)
clear()
number = number + 1
if number == text_length:
break
print(" ")
text_function("TEST INPUT")
sleep(3)
Thank you in advance.