小编Bry*_*yan的帖子

为什么 os.system('cls') 不清除最近的输出?

在使用Dev-C++之前我总是使用system('cls')C语言。现在正在学习Python,使用Pycharm 2020.2.3。

我尝试使用os.system('cls'). 这是我的程序:

import os

print("clear screen")
n = int(input(""))
if n == 1:
    os.system('cls')
Run Code Online (Sandbox Code Playgroud)

我的程序没有错误,但它没有清除最近的输出。

这是我的程序的输出:

我的输出的屏幕截图

为什么不清除最近的输出似乎是什么问题?

python os.system pycharm python-3.x

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

os.system ×1

pycharm ×1

python ×1

python-3.x ×1