为什么 Pylint 说 print('foo', end='') 是无效语法?
Why Pylint says print('foo', end='') is an invalid syntax?
这个非常简单的代码:
#!/usr/bin/python3
print('foo', end='')
让 Pylint 不高兴(在 Python2 和 Python3 上):
pylint ./pylint.py
No config file found, using default configuration
************* Module pylint
E: 2, 0: invalid syntax (syntax-error)
为什么?
我在 运行 pylint 时遇到了这个错误。但是我的 pylint 只支持 python2。所以报错了:
$ pylint foo.py
No config file found, using default configuration
************* Module foo
E: 2, 0: invalid syntax (syntax-error)
所以我做了 pip3 install pylint
。
然后一切正常(或者至少它克服了语法错误):
$ python3 -m pylint foo.py | head
No config file found, using default configuration
************* Module foo
C: 1, 0: Black listed name "foo" (blacklisted-name)
C: 1, 0: Missing module docstring (missing-docstring)
.....
有关 python2 和 3 在一个系统中的 pylint 的更多信息,请参见此处:https://askubuntu.com/questions/340940/installing-pylint-for-python3-on-ubuntu
这个非常简单的代码:
#!/usr/bin/python3
print('foo', end='')
让 Pylint 不高兴(在 Python2 和 Python3 上):
pylint ./pylint.py
No config file found, using default configuration
************* Module pylint
E: 2, 0: invalid syntax (syntax-error)
为什么?
我在 运行 pylint 时遇到了这个错误。但是我的 pylint 只支持 python2。所以报错了:
$ pylint foo.py
No config file found, using default configuration
************* Module foo
E: 2, 0: invalid syntax (syntax-error)
所以我做了 pip3 install pylint
。
然后一切正常(或者至少它克服了语法错误):
$ python3 -m pylint foo.py | head
No config file found, using default configuration
************* Module foo
C: 1, 0: Black listed name "foo" (blacklisted-name)
C: 1, 0: Missing module docstring (missing-docstring)
.....
有关 python2 和 3 在一个系统中的 pylint 的更多信息,请参见此处:https://askubuntu.com/questions/340940/installing-pylint-for-python3-on-ubuntu