Ask coding questions

← Back to all posts
How to clear the console in python
ThatOneGuy1234 (3)

I'm trying to make a console based game in python, but I want to clear the text that has accumulated in the console. Is there a certain command for this or will I just have to live with it?

Answered by Coder100 (16800) [earned 5 cycles]
View Answer
Coder100 (16800)


import os

easy, right?

JonahElias (156)

@Coder100 I tried this in PyCharm and it said
TERM environment variable not set.

Coder100 (16800)

@JonahElias then set the TERM env variable?

Coder100 (16800)

technically it should work no matter what, in the backend, in C:

int main()

which works on all windows and linux

JonahElias (156)

@Coder100 but what does that mean?

Coder100 (16800)

wdym what does it mean, ig your environment is just weird @JonahElias

Stan085 (23)

obtw os.system() is used for running bash