问题很简单,我的 Python 脚本中有两行:
# pylint: disable=C0301, W0212
#!/usr/bin/env python
他们都必须在第一行,否则他们将无法工作。
你建议我如何解决这个问题?
请您参考如下方法:
第一行是:
#!/usr/bin/env python
Pylint 消息可以在任何线路上进行。正如文档所说:
Is it possible to locally disable a particular message? This may be done by adding “#pylint: disable=W0123,E4567” at the desired block level or at the end of the desired line of code
所以消息需要处于相同的 block 级别(因此第二行可以工作,因为它是相同的 block /范围)。此外,文档说:
Is there a way to disable a message for a particular module only? Yes, you can disable or enable (globally disabled) messages at the module level by adding the corresponding option in a comment at the top of the file:
所以它不会说:“文件的第一行”;只要禁用消息位于文件顶部就可以了。
