python3报错:IndentationError: expected an indented block

作为一个热爱技术的小编,在学习python的时候自然少不了各种错误。今天在写一个小系统的时候遇到一个IndentationError: expected an indented block这样的错误,查看python报的Traceback错误发现提示缩进错误。二话不说先上代码

python3报错:IndentationError: expected an indented block

报错截图:

python3报错:IndentationError: expected an indented block

python对代码格式要求比较严格,查看发现else有缩进且和if语句形成对称,仔细查看发现是if语句块没有内容,这样的情况下要有占位语句pass(pass不做任何事情,作为占位语句,保持结构完整性),小编把pass添加上之后,完美解决

 

 

相关文章:

  • 2021-05-05
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2021-09-13
  • 2022-12-23
  • 2021-10-21
猜你喜欢
  • 2021-10-18
  • 2021-08-25
  • 2021-11-24
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
相关资源
相似解决方案