如何在python中清除屏幕 [英] how to clear the screen in python
问题描述
可能的重复项:
使用python清除终端
如何清除python解释器控制台?
Possible Duplicates:
clear terminal in python
How to clear python interpreter console?
我正在尝试用Python编写程序,但是我不知道如何清除屏幕. 我同时使用Windows和Linux,并使用命令来清除其中的屏幕,但我不知道如何在Python中做到这一点.
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.
如何使用Python清除屏幕?
How do I use Python to clear the screen?
推荐答案
如果您的意思是在屏幕上显示解释器提示>>>
,则可以执行 CTRL + L 在Bash shell上可以提供帮助. Windows没有等效项.您可以
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
或
os.system('clear') # on linux / os x
这篇关于如何在python中清除屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!