我正在为 Eclipse 使用 pydev 插件,并且在尝试包含 unicode 字符串时遇到了问题。据我所知,这不是命令行上 pydev 和 python 之间的 unicode 兼容性的常见问题。
如果我使用如下的 unicode 字符串:
INFINITY_STRING = u"\u5555"
pydev 用错误标记它:
Multiple markers at this line
- occurrence
- Undefined variable: u
- Encountered "\"\\u5555\"" at line 54, column 13. Was expecting one of: <NEWLINE> ... "(" ... "[" ... ";" ... "," ... "." ... "+" ... "-" ... "*" ... "/" ... "//" ...
"<<" ... ">>" ... "%" ... "^" ... "|" ... "&" ... "=" ... ">" ... "<" ... "==" ... "<=" ... ">=" ... "!=" ... "or" ... "and" ... "not" ... "is" ... "in" ... "if" ...
";" ... "," ...
代码可以编译并运行,但这个假定的错误会扰乱自动完成和重构功能。有谁知道如何防止 pydev 在出现 unicode 字符串时抛出错误?