Ask coding questions

← Back to all posts
ModuleNotFoundError: No module named 'replit'
JoshD1 (0)

I googled the error i got and found people answering the question saying it couldnt be in project mode. I made a single file, and it still wont let me import replit. This is code that someone gave since it wasn't a project, and it still fails to work

Answered by Klokat (41) [earned 5 cycles]
View Answer
Commentshotnewtop
Klokat (41)

I'm not sure what's with import replit. But if you really need to clear the screen there's a non-portable solution by using https://en.wikipedia.org/wiki/ANSI_escape_code.

print("hi")
input("enter to clear")
print("\x1B[2J")
print("cleared")

"\x1B" is the character for the escape key [ is the Control Sequence Introducer and then 2J which clears the entire screen as you can see from the Wikipedia article. Again this is not a portable solution but if you really need a quick solution there you have it.