def clear():
  print("\x1B[2J")

clear()

Correction: you were right, I couldn't make it work on windows. The ANSI.SYS driver works only with very old versions of windows. You would need a terminal emulator similar to the linux console. There is a module console for windows, with slightly different control sequences. See if it works with your versions of windows/python.

So let's say it's linux only...

Edited 7 Years Ago by Gribouillis: n/a

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.