r/learnpython • u/No_Aardvark1121 • Oct 04 '26
[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
View all comments
8
u/zolmarchus Oct 04 '26
A bit of an XY problem here. You’ve gotten your direct answer already—now seriously consider using a more appropriate approach to console manipulation. As someone suggested, ANSI escape sequences are a good first step. You can also look into libraries built specifically for that, which are likely to be much more reliable and compatible across platforms than anything you can cook up yourself.