如何在崇高的文本编辑器中清除控制台

How to clear console in sublime text editor(如何在崇高的文本编辑器中清除控制台)

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

问题描述

如何在 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

推荐答案

我假设你说的是通过 View -> 访问的控制台显示控制台Ctrl`.不同于 其他 答案 在 SO 上,处理从命令提示符打开时清除 Python 控制台,os.system("cls")os.system("clear") (取决于您的操作系统)不适用于 Sublime 控制台.Sublime API(版本 2 或 version 3) 没有任何内置的控制台清除方法,我无法在 sublime.pysublime_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(' '*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.

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

本文标题为:如何在崇高的文本编辑器中清除控制台

基础教程推荐