如何在sublime文本编辑器中清除控制台 [英] How to clear console in sublime text editor

查看:2216
本文介绍了如何在sublime文本编辑器中清除控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在sublime文本编辑器中清除控制台。
我在互联网上搜索了。但是找不到适当的快捷方式。
请提供信息

How to clear console in sublime text editor. I have searched on internet too..But can't find proper shortcut for that. Please provide info

推荐答案

我假设你正在谈论控制台可通过 查看 - >显示控制台 Ctrl `。与其他 答案 on SO,它处理在命令提示符处打开时清除Python控制台 os.system(cls) os.system clear)(取决于您的操作系统)不适用于Sublime控制台。 Sublime API (版本2或版本3 )没有任何内置的控制台清除方法,我在 sublime.py sublime_plugin.py 。控制台似乎是只读的,因为选择所有文本并点击 Delete 也不起作用。

I assume you're talking about the console accessible via View -> Show Console or Ctrl`. Unlike other answers on SO, which deal with clearing the Python console when opened from the command prompt, os.system("cls") or os.system("clear") (depending on your OS) don't work with the Sublime console. The Sublime API (version 2 or version 3) does not have any built-in console-clearing method, and I was unable to find any undocumented method in sublime.py or sublime_plugin.py. The console appears to be read-only, as selecting all the text and hitting Delete doesn't work either.

进入这一段时间,我得出结论,它似乎是不可能的。但是,有一个hackish的解决方法 - 只需运行 print('\\\
'* 100)
打印100个换行符,您将看不到任何先前的输出,除非你向上滚动一些距离。

I've been looking into this for some time, and I've come to the conclusion that it does not appear to be possible. However, there is a hackish workaround - just run print('\n'*100) to print 100 newline characters, and you won't be able to see any of the previous output unless you scroll up some distance.

这篇关于如何在sublime文本编辑器中清除控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆