def clearscreen(numlines=100):
    """Clear the console.
    numlines is an optional argument used only as a fall-back.
    """
import os
if os.name == 'posix':
    os.system('clear')
elif os.name in ('nt', 'dos', 'ce'):
    os.system('CLS')
else:
    print('\n' * numlines)
Deleting already printed in Python