SublimeREPL(python)中的字符串后面出现红线吗? [英] Red lines coming up after strings in SublimeREPL (python)?

查看:259
本文介绍了SublimeREPL(python)中的字符串后面出现红线吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编写一个简单的python应用程序时,我正在使用Windows 2.的Python 2.7.8和Sublime 3(64位)在SublimeREPL(对于python)中向控制台打印一些字符串.但是,在我打印的每个字符串之后,都会出现一些非常烦人的红线.有人知道为什么会这样吗?

In writing a simple python application, I'm printing out some strings to the console in SublimeREPL (for python), using Python 2.7.8 and Sublime 3, 64 bit for Windows 8.1. However, I'm getting some very annoying red lines after each of the strings that I'm printing. Does someone know why this is happening?

我将不胜感激.

谢谢!

推荐答案

撇号'字符使Sublime的语法突出显示引擎认为您正在开始使用单引号引起来的字符串.由于以字符串"open"结尾的行是错误的,因此在您的配色方案中使用红色的invalid.illegal范围突出显示了该行.不用担心,当一行上有非封闭引号时,SublimeREPL就会发生这种情况.

The apostrophe ' character is causing Sublime's syntax highlighting engine to think that you're beginning a single-quoted string. Since ending a line with a string "open" is an error, it is being highlighted with the reddish invalid.illegal scope in your color scheme. It's nothing to worry about, it's just something you'll see happen with SublimeREPL when you have non-closing quotes on a line.

要验证这种情况,请尝试在Sublime中打开一个新文件,将语法设置为Python,然后粘贴以下代码:

To verify this is the case, try opening a new file in Sublime, setting the syntax to Python, and pasting in the following code:

"This is a valid string"
"This is also valid even though it has a single quote ' char"
"This string is not valid
"""This string is valid, and doesn't have the red line
even though it has a newline, as it's triple-quoted"""

中间(无效的Python语法)行将从单词valid的末尾到窗口右侧的红色条纹.其他人不会.

The middle (invalid Python syntax) line will have the red stripe from the end of the word valid to the right side of the window. The others won't.

这篇关于SublimeREPL(python)中的字符串后面出现红线吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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