最近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
删除多余的空格
博主在使用Pycharm时遇到报错,经搜索得知是PEP8规范相关问题。文中详细列举了如逗号前后空格、文件末尾换行、类和函数定义后空行、行内注释格式等多种PEP8规范错误及含义,帮助开发者理解规范要求。
2840

被折叠的 条评论
为什么被折叠?



