python pep8:e305
时间: 2023-10-19 19:35:43 浏览: 157
PEP8规范-python相关
PEP 8是Python编程规范的一部分,其中包括了命名规范、注释规则和编程推荐等内容。错误信息PEP 8: E305 expected 2 blank lines after class or function definition, found 1意味着在函数定义后只有一个空行,但是规范要求在函数定义后添加两个空行。
解决这个问题的方法很简单,只需要在函数定义后面添加两个空行即可。这样就符合了PEP 8的要求,也能解决错误信息中提到的问题。
如果你遵循了PEP 8编码规范,不仅能提高代码的可读性,也能让你的代码更加规范和易于维护。你可以下载PEP 8编程规范的文档,详细了解其中的内容和建议。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [【错误记录】PyCharm 运行 Python 程序报错 ( PEP 8: E305 expected 2 blank lines after class or ...](https://blog.csdn.net/han1202012/article/details/120644818)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Python编程规范PEP8.pdf](https://download.csdn.net/download/wanderkid/12254753)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [PEP 8: E305 excepted 2 blank lines, after class or function definition, found 1](https://blog.csdn.net/feizuiku0116/article/details/126372276)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文