How to auto-clear console history in python

UPDATE: I found a way to improve on this method. After you print some newlines, clear the console so that the output starts at the top, and so the run’s output does not have useless newlines.
Note that a single previous run will still show, but it’s just one line at the top.
Python version:

import os
def clear():
  """There are many alternatives to clearing the console, this is just one."""
  os.system('cls' if == 'nt' else 'clear')
print('\n' * os.get_terminal_size().lines)