Skip to content
← Back to Community
Replit Import List
Profile icon
BD103

Hi! I’ve been messing around with imports in Python, and saw the replit import thing. I know about the replit.clear() function, but I don’t know what any of the other imported code does. Can you give me a list of code that the replit import adds in? Thanks!

Answered by mat1 [earned 5 cycles]
View Answer
Voters
Profile icon
OmarMiles1
Profile icon
JulianJoseph1
Profile icon
user9qwiueyuiwo2owieufh
Profile icon
aatishkotni
Profile icon
LucasYeung1
Profile icon
hokk
Profile icon
DynamicSquid
Profile icon
BD103
Comments
hotnewtop
Profile icon
mat1

You can see all the packages that you can install for Python on the Python Package Index

Profile icon
SixBeeps

Which package are you talking about? The only one I see named 'replit' is by @mat1, which appears to only be memes.

Profile icon
BD103

When you are on the repl.it editor, you can type in the code import replit and it adds in some things like the replit.clear() code. @niorg2606

Profile icon
mat1

@niorg2606 hehe (my package still has the clear function so it shouldn't break anything)

Profile icon
SixBeeps

@mat1 ahaha, nice.

Profile icon
BD103

How does the clear() function work? @mat1

Profile icon
mat1

@BD103 It just runs print('\033[2J\033[H', end=''). This is an ANSI escape sequence that first deletes all the text on the screen (\033[2J) and then moves the cursor to the start (\033[H). The end='' is just so it doesn't print anything extra, since by default it puts a new line (\n) after the message.

Profile icon
SixBeeps

@mat1 I hate ANSI with all my might but dang does it work like magic, like RegEx.

Profile icon
BD103

Thanks! @mat1