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.
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.
Describe your feature request
Please bring back the old console, the new one looks insanely ugly.
What problem(s) would this feature solve?
Not having to press the delete button every time I run the repl
console<a class="lightbox" href="https://global.discourse-cdn.com/business7/uploads/replitteams/original/3X/4/8/485a2eb832bba614df41b82f6c65fadbffa1c66f.png" data-download-href="/uploads/short-url/ak3ALqzrJLUxjF33myk3HiwZ6pN.png?dl=1" title="image"…
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:
UPDATE: I found a way to improve on this method. After you print some newlines, clear the console so that the output starts at the top, and so the run’s output does not have useless newlines.
Note that a single previous run will still show, but it’s just one line at the top.
"""There are many alternatives to clearing the console, this is just one."""
os.system('cls' if os.name == 'nt' else 'clear')
print('\n' * os.get_terminal_size().lines)
This doesn’t look like the Console though. I don’t recognise it.
@YusFaz you can press the 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.
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
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.
@jasecrowe, this should only clear the CURRENT run’s output. OP wants it to clear every run before it.
@YusFaz please try this: