Skip to content
← Back to Community
How do you clear the output screen off all text(python 3)
Profile icon
[deleted]

how do you clear the output screen of all text in python 3

Answered by HappyFakeboulde [earned 5 cycles]
View Answer
Voters
Profile icon
Ryan1Hernandez
Comments
hotnewtop
Profile icon
HappyFakeboulde

If you have explorer mode, use __import__("os").system("cls" if os.name == "nt" else "clear").
If not, use __import__("replit").clear().

Profile icon
[deleted]

thanks that worked

Profile icon
Nayoar

Hey,
The way I usually do it only works on Repl.it, but is very easy:

import replit do_stuff() replit.clear()

Hope you found this comment helpful
Upvote for vee freebucks!

Profile icon
PYer

@minx28 Only works in the terminal. You cannot run it in main.py

Profile icon
minermaniac447

@fullern000 false.

import replit replit.clear()

works just fine in main.py

Profile icon
Nayoar

@fullern000 i think you're getting a bit confused - it only works in eval mode, which is when you only have a single .py file

Profile icon
PYer

@minermaniac447 Really? That has changed then since I last used it. It used to be that you could only do that in the shell.