开发者社区 问答 正文

python3怎么清屏

python3怎么清屏

展开
收起
保持可爱mmm 2019-12-11 14:10:04 282 分享 版权
1 条回答
写回答
取消 提交回答
  • 在交互模式中使用Python,如果要清屏,可以import os,通过os.system()来调用系统命令clear或者cls来实现清屏。

    import os

    os.system('clear')

    但是此时shell中的状态是:

    0

    首行会有一个0。这个0实际上是os.system()的返回值,0是成功,非零即error code。

    问题来源于python学习网

    2019-12-11 14:10:15
    赞同 展开评论
问答分类:
问答标签:
问答地址: