大家好,刚刚开始使用python的vs代码。我使用的是python版本3.8。我已经安装了python扩展,它有助于语法完成,但它根据python 2.7给出了建议,并在使用python 3中包含的新语法时给出了错误。你们能告诉我哪些设置需要更新吗?
def fibonacci_series(lim):
print("-- Fibonacci Series --")
a=b=1
for x in range(0, lim):
yield a
a,b = b,a+b
def main():
for x in fibonacci_series(5):
print(x , end=" ") # <- vs code says this is invalid syntax, but still runs it successfully.
print()
main()
我有这样的设置.json。
settings.json
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.pylintPath": "/usr/bin/pylint",
"python.pythonPath": "/usr/bin/python3.8",
"code-runner.executorMap":
{
"python": "python3.8 -u"
}
}
慕斯709654
相关分类