常见易错的PEP8规范:PEP 8: W292 no newline at end of file等
最近pycharm总是报这个错误,搜索才知道这是PEP8规范。 ( Python Enhancement Proposal ) PEP 8: E231 missing whitespace after ‘,’ 这个意思是逗号后面要有一个空格 PEP 8: E203 whitespace before ‘,’ 这个意思是逗号前面不能有空格 PEP 8: W292 no newline at end of file 这里是要求你在末尾新起一行 PEP 8: E305 expected 2 blank lines after class or function definition, found 0 这个是写完函数和类之后要空出两个空行(方便区分) PEP 8: W391 blank line at end of file 就是这个结尾是空行,你需要把光标指向第一列 PEP 8: E251 unexpected spaces around keyword / parameter equals 就是多了空格 PEP 8: E261 at least two spaces before inline comment 行内注释前需要两个空格 PEP 8: E262 inline comment should start with ‘# ’ 行内注释应该以’#'加空格开始 PEP 8: E302 expected 2 blank lines, found 1 就是希望有两个空行来区分 PEP 8: E271 multiple spaces after keyword 关键字后空格多了 PEP 8:Remove redundant parentheses 删除多余的空格