0

I have the following python code to clear the console on my windows computer:

import os
os.system('cls')

However, I would like it to work on linux as well. Is there a universal clear command that works on all operating systems, without adding a bunch of blank lines to the bottom of the console?

1 Answers1

0

Try this:

def clear():
    print(chr(27)+'[2j')
    print('\033c')
    print('\x1bc')

ma4strong
  • 195
  • 1
  • 5