How do I get my Replit to show only the new code I built , not the old , previous code?

Like I want my console to show the current code when I press run not to show the old code I built which is on top of the current one which makes it look messy

I tried to search for it but I couldn’t find any help so can somebody please help me about it.

Thanks, Yus

If you provide a project link, I or others could help. Also, more context is needed. Do you want to show new code and not old code, but you want to keep old code?

I want it to show my new code only, not the old code like basically refreshing the old code into the new code. It happened before on another laptop but on my current device, I’m not seeing what I want.
I’ll send an image to evaluate what I want my console display to look like:

A recent update changed the console.
There is a feature request to bring the old console back.

I doubt they will be bringing it back though.

There is a “workaround” to get rid of the previous runs outputs. Basically, you print a bunch of lines to push the previous runs away, and then you clear the current console. Here is a python version:

1 Like

This doesn’t look like the Console though. I don’t recognise it.

@YusFaz you can press the :wastebasket: trash button next to where it says “Console” to clear the Console output.

They said this is what they want it to look like.


Ah i see now. There’s 2 ways to do it. replit.clear which I’m not sure if that’s it or if there’s another part, and the way i do it for now.

import os
def clearConsole():

Call the functions when you wanna clear the console. Theirs is a better and faster way to do it but that’s Howe i do it.
edit2: When you do this, make sure to have a userInput or time.sleep because it will just instantly clear and move on wherever you put the clearConsole() of you do it my way
edit: Whoever changed the code to look like code thank you I didn’t know how to do that

1 Like

Sorry, I’m new to Coding but what do I do with this code

That would be me, I wrapped your code in triple backticks. (```)


There is a better and faster way to do it but that’s how I do it.*

Also the much better and faster way would be:


The fastest way is in the Replit module:

from replit import clear

or you can just use the code that Replit’s module uses:

print("\033[H\033[2J", end="", flush=True)

Although the difference in speed between these methods are not much.

Also, @jasecrowe, this should only clear the CURRENT run’s output. OP wants it to clear every run before it.

@YusFaz please try this: