当前位置:问百问>百科问答>python自学菜鸟 expected an indented block什么意思

python自学菜鸟 expected an indented block什么意思

2025-03-28 15:40:07 编辑:zane 浏览量:548

python自学菜鸟 expected an indented block什么意思

的有关信息介绍如下:

python自学菜鸟 expected an indented block什么意思

该缩进的地方没有缩进,就会报错expected an indented block

因为Python语言是一款对缩进非常敏感的语言

比如下面的代码

会报错

 File "D:/num.py", line 4

    print "a>b"

        ^

IndentationError: expected an indented block

修改如下

从属代码块, 需要缩进

从属代码块, 需要缩进的关键字主要有

if、while、for、try-except,def 等

版权声明:文章由 问百问 整理收集,来源于互联网或者用户投稿,如有侵权,请联系我们,我们会立即处理。如转载请保留本文链接:https://www.wenbwen.com/answer/277601.html
热门文章