清除python中以前的终端输出
有没有办法清除终端以前的输出?如果是,怎么做?下面是一个代码示例清除python中以前的终端输出,python,Python,有没有办法清除终端以前的输出?如果是,怎么做?下面是一个代码示例 print "Hello..." #Code that clears previous terminal output print "All cleared!" 我知道移动应用程序pythonista有一个iOS模块可以做到这一点,但我想知道如何在Linux上做到这一点。根据您是在Windows还是Linux上,您可以做到: import os os.system('cls') #Windows os.system('cle
print "Hello..."
#Code that clears previous terminal output
print "All cleared!"
我知道移动应用程序pythonista有一个iOS模块可以做到这一点,但我想知道如何在Linux上做到这一点。根据您是在Windows还是Linux上,您可以做到:
import os
os.system('cls') #Windows
os.system('clear') #Linux
例如:
print 'Hello...'
os.system('clear') #or os.system('cls') for Windows
print "All cleared!"
@那个不好的代码员有什么意义?答案已经在这里给出了@TheNotGoodAtCodeGuy为什么你不能点击链接并在那里阅读答案?