【发布时间】:2015-01-26 22:01:16
【问题描述】:
我的 python 代码产生以下警告消息:
(1) \dir\file.py:8:1 W293 blank lines contains whitespace
this comes after commands[0] flake8 XXX
你如何解决这个问题?
【问题讨论】:
-
确保任何看似空白的行都没有空格或制表符。
我的 python 代码产生以下警告消息:
(1) \dir\file.py:8:1 W293 blank lines contains whitespace
this comes after commands[0] flake8 XXX
你如何解决这个问题?
【问题讨论】:
使用来自this question 的相同主体,您可以使用autopep8 自动修复这些问题。语法是...
autopep8 --select=W293 --in-place your_file.py
【讨论】:
setup.cfg ... [pycodestyle] ignore = W293 有关更多信息,请参阅文档。 pep8.readthedocs.io/en/latest/intro.html#configuration
只需从 file.py 中的第 8 行删除空格、制表符或其他空白字符。
【讨论】:
空行不应包含任何制表符或空格。因此,根据 PEP8 删除多余的空格。 来源-https://ayush-raj-blogs.hashnode.dev/making-clean-pr-for-open-source-contributors-pep-8-style
【讨论】: