Python学习小记:IndentationError: expected an indented block
使用cmd编写python,遇到 “IndentationError: expected an indented block” 的错误,原因是:没有缩进!!!
如图,对于for循环下面的print,在…后面应该用tab键缩进可以。Python对于缩进十分敏感,一旦错误,会发生不可预估的后果。缩进后就可以得到正确的结果了。
使用cmd编写python,遇到 “IndentationError: expected an indented block” 的错误,原因是:没有缩进!!!
如图,对于for循环下面的print,在…后面应该用tab键缩进可以。Python对于缩进十分敏感,一旦错误,会发生不可预估的后果。缩进后就可以得到正确的结果了。