Red lines coming up after strings in SublimeREPL (python)?

二次信任 提交于 2019-12-08 03:10:26

问题


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?

I would appreciate any help.

Thanks!


回答1:


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.

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"""

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.



来源:https://stackoverflow.com/questions/25693151/red-lines-coming-up-after-strings-in-sublimerepl-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!