禁用 SublimeREPL 反斜杠突出显示 [英] disable SublimeREPL backslash highlights

查看:35
本文介绍了禁用 SublimeREPL 反斜杠突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用 python 运行 SublimeRepl 时,我注意到它总是突出显示一些反斜杠 + 字符.我不知道为什么会这样,有没有关于为什么会发生这种情况以及如何禁用它的建议?

附注我的搜索使我找到了 ANSII 转义代码/颜色代码,甚至语法突出显示.这些相关吗?我不确定,因为我对这些主题不太了解

解决方案

在 python 中,除非存在 'r' 或 'R' 前缀,'\' 之后的每个字符都被解释为转义序列.这里突出显示的不是有效的转义序列.\a 在这里没有以同样的方式突出显示,因为它是一个有效的转义序列.

<块引用>

\a ASCII 响铃 (BEL)

如果你想在字符串中使用反斜杠,你应该像这样使用双斜杠(\\)

<预><代码>>>>打印(c:\\my_main\\asdf\\xsdf")

When running SublimeRepl with python, I have noticed that it always highlights some backslash + characters. I am not sure why this, any suggestion into why this is going on and how to disable this ?

side note My search led me to ANSII escape code/color code, or even syntax highlighting. are these relevant ? I am not sure since I don't know much about these topics

解决方案

In python unless an 'r' or 'R' prefix is present, every character after '\' is interpreted as an escape sequence.And the ones that are highlighted here are not valid escape sequences. \a is not highlighted here in the same fashion because it is a valid escape sequence.

\a ASCII Bell (BEL)

If you want to use a backslash inside a string, you should use double slashes(\\) like this,

>>> print("c:\\my_main\\asdf\\xsdf")

这篇关于禁用 SublimeREPL 反斜杠突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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