Clear terminal in Python
是否存在任何标准的“附带电池”方法来清除Python脚本中的终端屏幕,还是必须去诅咒(图书馆,而不是词)?
关于转义序列呢?
print(chr(27) + "[2J")
 A simple and cross-platform solution would be to use either the cls command on Windows, or clear on Unix systems.  Used with os.system , this makes a nice one-liner:  
import os
os.system('cls' if os.name == 'nt' else 'clear')
 Why hasn't anyone talked about just simply doing Ctrl+L.  
 Surely the simplest way of clearing screen.  
上一篇: 超级(类型,对象
下一篇: 在Python中清除终端
