3 Réponses
+ 4
import os
os.system('clear')
# but this could not work anywhere...
# however, you can also do:
cls = '\33[2J\33[H'
print(cls+'test')
"""
... which could ever not work sometimes, but got more probability to work as expected.
First sequence if escaped terminal command clear screen, and second position cursor at first row, first line (safer, as not always done by clear screen command ^^)
Well, but you must know that all that kind of stuff doesn't work at all in code playground, due to limitations of in/output :P
"""
0
Try something like that:
import os
def cls():
os.system('cls')
cls()
0
I tried it by seeing in Google
but doesn't clears the screen