+ 4
Is that any other way to clear screen in pythone ?
print('\033[H\033[J') that is used to clear sreen
1 Odpowiedź
+ 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 .