Is that any other way to clear screen in pythone ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Is that any other way to clear screen in pythone ?

print('\033[H\033[J') that is used to clear sreen

11th Aug 2018, 5:14 PM
The Shiva
The Shiva - avatar
1 Answer
+ 1
you can use following: from os import system #for windows, use system('cls') #for linux, mac , use system('clear') In case you're not sure about the operating system( which I believe, wouldn't be true) or you want to generalise it for cross platform then you can make use of `os.name`. #for windows, os.name='nt' #for mac,linux, os.name='posix' You can just create an if-else based on os.name .
27th Aug 2018, 2:38 AM
Шащи Ранжан
Шащи Ранжан - avatar