[英]VSCode: how to automatically clear Python terminal output window before each run using VS Code tasks?
[英]How to clear 'run' window in PYCHARM using python code when needed
每次循环运行以清除某些文本时,我想使用 python 代码清除“ run
” window 代码。
有人可以帮忙吗??
您可以将os.system('clear')
用于 mac,将 linux 和os.system('cls')
用于 windows。
例如:
import os
for i in range(100):
print(i)
os.system('clear')
如果您收到TERM environment variable not set
警告,请单击运行按钮左侧的Open 'Edit run/debug configurations' dialog
,然后选中Edit Configurations -> Executions -> Emulate terminal in output console
的复选框。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.