Ask coding questions

← Back to all posts
From replit import clear is no longer supported?
Zexogon (592)

Ok so from my understanding you have to require something else, but why? Not to long ago you only had to import clear from replit and it would work and I have no idea why they would change it I guess I have to go back and define a clear function with os now

Answered by mat1 (2940) [earned 5 cycles]
View Answer
Commentshotnewtop
mat1 (2940)

from replit import clear should still work in Python. If you want to do it in another language (or don't want to import anything), just print \033[H\033[2J. This will move the cursor to the beginning of the terminal and delete all the text on it.

Zexogon (592)

@mat1 it sadly does not work for me, why was it discontinued in the first place?

mat1 (2940)

@Zexogon I just tried and it doesn't work now, weird. Just try the alternative I gave or install replit from the package manager (I made the package and the only function it has is clear)

nithilan4 (116)

@Zexogon u gotta import it from package manager again but if that doesnt work then mat's is good

TaylorLiang (615)

well, os clear is better