python问题:IndentationError:expected an indented block错误 野性酷女 2022-09-26 02:18 138阅读 0赞 # python问题:IndentationError:expected an indented block错误 # Python语言是一款对缩进非常敏感的语言,最常见的情况是tab和空格的混用会导致错误,或者缩进不对。 >>> a=100 >>> if a>=0: ... print a File "<stdin>", line 2 print a ^ IndentationError: expected an indented block 在编译时会出现这样的错IndentationError:expected an indented block说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。 修改后如下: >>> a=100 >>> if a>=0: ... print a ... else: ... print -a ... 100
还没有评论,来说两句吧...