IndentationError: expected an indented block after function definition on line 8
时间: 2023-08-25 19:13:37 浏览: 191
Python--学习笔记.docx
回答: 这个错误提示表明在第8行函数定义之后缺少了一个缩进块。Python语言对缩进有严格的要求和控制,缩进错误会导致编译运行出现IndentationError: expected an indented block这样的报错提示。在编写代码时,需要注意在函数定义之后需要添加一个缩进块,以表示函数体的范围。你可以在出现错误的那一行按空格或Tab键缩进来解决这个问题。比如,你可以在第8行之后添加一个缩进块来修复这个错误。<em>1</em><em>2</em>
#### 引用[.reference_title]
- *1* [Python学习:IndentationError: expected an indented block](https://blog.csdn.net/m0_52309938/article/details/120622439)[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^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [IndentationError:expected an indented block错误解决](https://blog.csdn.net/qq_31457413/article/details/98947128)[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^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文