There way I see it, there are 2 ways I think that are effective:
import os
os.system("clear||cls") # For clearing the current OS's (or online gdb's) output consoleOr
print("\033c",end='') # Uses octal escape sequence "c" to clear the terminal, without a newlineHopefully that helps.
:)