python代码下出现红线_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?

I would appreciate any help.

Thanks!

解决方案

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值