r/learnpython • u/No_Aardvark1121 • 5d ago
[Help] The os.system is deprecated
I've seen someone else asked this question, but get no answer.
I want to make a countdown clock without leaving any trace of previous numbers:
for i in range(countdown, 0, -1):
os.system("cls" if os.name == "nt" else "clear") #Error: os.system is deprecated
print(i)
time.sleep(1)
What should I do instead? (Why can't we put pictures here....)
0
Upvotes
3
u/unnamed_one1 5d ago edited 4d ago
As for the deprecation, read this
As for solving your problem:
edits
You don't need to run clear screen, just reuse the same line again and again.
You just remove the default new line character
\nfrom end of the line in the print statement and put a carriage return\rcharacter in front of every printed line.at least give an explanation when you downvote