Fastest way to clear the Console in Python

Actually, it’s faster. A lot faster.

1 Like

Well, it took like 2 seconds to clear with replit clear
while it took less than 1 for os.system.

…Did you… Even see the screenshot I posted?

1 Like

Yes I did. I am not joking syst(‘clear’) is faster.

And where is your proof? Time it, like how I did.

1 Like

Alright. Give me a second while I do this.

:scream:

os.system took 5.4793174266815186 seconds
replit clear took 0.007810115814208984 seconds

L-LOOKS LIKE I WAS WRONG :sob:
omg i look really dumb rn

replit is way faster

2 Likes

Or, you can use @QwertyQwerty88’s solution which is even faster than Replit’s IIRC.

def clear():
    print("\033c", end="", flush=True)
2 Likes

I actually tested that and it’s slower than Replit (I thought it was faster but I guess not!)

“if If I Recall Correctly.”

2 Likes