开发者

how to clear the screen in python [duplicate]

开发者 https://www.devze.com 2023-02-07 10:32 出处:网络
This question already has answers here: Close开发者_StackOverflowd 12 years ago. Possible Duplicates:
This question already has answers here: Close开发者_StackOverflowd 12 years ago.

Possible Duplicates:

clear terminal in python

How to clear python interpreter console?

I'm trying to write a program in Python but I don't know how to clear the screen. I use both Windows and Linux and I use commands to clear the screen in those, but I don't know how to do it in Python.

How do I use Python to clear the screen?


If you mean the screen where you have that interpreter prompt >>> you can do CTRL+L on Bash shell can help. Windows does not have equivalent. You can do

import os
os.system('cls')  # on windows

or

os.system('clear')  # on linux / os x
0

精彩评论

暂无评论...
验证码 换一张
取 消