2019-01-17
阅读量:
788
python基本错误(二)
错误的使用缩进量。(导致“IndentationError:unexpected indent”、“IndentationError:unindent does not match any outer indetation level”以及“IndentationError:expected an indented block”)
记住缩进增加只用在以:结束的语句之后,而之后必须恢复到之前的缩进格式。该错误发生在如下代码中:
print('Hello!')
print('Howdy!')或者:
if spam == 42:
print('Hello!')
print('Howdy!')
或者:
if spam == 42:
print('Hello!')
在python中,对缩进的要求很高,需要严格规范。
2.9470
1
3
关注作者
收藏
评论(0)
发表评论
暂无数据
推荐帖子
0条评论
0条评论
3条评论

