边学边总结,今天看if语句,在if中嵌套遇到了报错,原代码如下:
Python报错:IndentationError: expected an indented block然后就报错了
Python报错:IndentationError: expected an indented block这种报错是由于缩进错误产生的,如第一图中第二个if后跟的print没有缩进,一定要注意缩进,python对此非常敏感。
改正后如下:
Python报错:IndentationError: expected an indented block这样就可以正常运行了

相关文章: