Instead of using
print()
, it might be easier to use a system call (though apparently, using print is possible, see PIEBALDconsult's answer). To execute a system call, use
os.system
.
import os
os.system('cls')
cls
is Windows-only. If you use Linux or Mac OS, use
clear
instead.
How does this work?
os.system
executes a system call; so it calls the
cls
command which clears the screen.