我是 python 新手。我在 Eclipse Kepler 中使用 Python 3.3。
这是我的代码片段:
f = Fibonacci(0,1)
for r in f.series():
if r > 100: break
print(r, end=' ')
在 print(r, end = '')
行,eclipse 报告了一个语法
错误 - 检测元组时出现语法错误
。但是,那
程序完美运行。
为什么会发生这种情况以及如何修复错误?
最佳答案
您需要在 Eclipse 中指定正确的语法版本
。看这里:print function in Python3
Grammar Version
3.3 在您的设置中吗?步骤 - 项目 > 属性 > Python 解释器/语法。您可能必须重新启动 Eclipse 才能看到更改。
关于Python 代码有效,但 Eclipse 显示错误 - Syntax error while detecting tuple,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22489084/