Python 错误:IndentationError: expected an indented block
2016-12-29 12:04
741 查看
Python是一款对缩进非常敏感的语言,常见的情况是tab和空格的混用会导致错误,或者缩进不对
在编译时会出现这样的错IndentationError:expected an indented block
说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。
往往有的人会疑问:我根本就没缩进怎么还是错,不对,该缩进的地方就要缩进,不缩进反而会出错,比如:
if xxxxxx:
(空格)xxxxx
或者
def xxxxxx:
(空格)xxxxx
还有
for xxxxxx:
(空格)xxxxx
一句话 有冒号的下一行往往要缩进,该缩进就缩进
在编译时会出现这样的错IndentationError:expected an indented block
说明此处需要缩进,你只要在出现错误的那一行,按空格或Tab(但不能混用)键缩进就行。
往往有的人会疑问:我根本就没缩进怎么还是错,不对,该缩进的地方就要缩进,不缩进反而会出错,比如:
if xxxxxx:
(空格)xxxxx
或者
def xxxxxx:
(空格)xxxxx
还有
for xxxxxx:
(空格)xxxxx
一句话 有冒号的下一行往往要缩进,该缩进就缩进
相关文章推荐
- 解决python中出现的IndentationError: expected an indented block的错误
- python错误:IndentationError:expected an indented block
- python程序有问题:错误提示:IndentationError:expected an indented block!
- python中IndentationError: expected an indented block错误的解决方法
- Python错误:IndentationError: expected an indented block
- python中IndentationError: expected an indented block错误的解决方法
- Python初学时的一个小错误:IndentationError: expected an indented block
- Python: IndentationError:expected an indented block
- python:IndentationError:expected an indented block
- 【Python】异常:IndentationError:expected an indented block
- Python_IndentationError:expected an indented block
- 错误:IndentationError: expected an indented block
- Python常见问题解决办法之:python indentationerror:expected an indented block
- python: IndentationError: expected an indented block问题解决
- 关于Python报错:IndentationError:expected an indented block
- python报错:IndentationError:expected an indented block
- python问题--缩进,IndentationError:expected an indented block
- python:IndentationError:expected an indented block问题
- Python问题-IndentationError: expected an indented block
- python3.5入门1--运行报错:IndentationError: expected an indented block