
22 Dec
2020
22 Dec
'20
1:49 a.m.
The simplest answer is
print('`\x1b[2J\x1b[H')
Are there any terminals that this does not work on that are in active use?
Is using curses that uses termcap needed these days?
Of course Windows is the outlier, but the new Windows Terminal supports ANSI escapes sequences and utf-8.
I tested the above with Windows Terminal 1.4 on Windows 10 and it just works.
Otherwise os.system('cls') works for windows terminal and the old windows console stuff.
Barry