>>> a
[1, 2, 3, 4, 5]
>>> for i in a :
... print i
File "<stdin>", line 2
print i
^
IndentationError: expected an indented block
剛開始學python用for循環時就撞牆,感覺自己的代碼和書上的完全是一樣的,結果就是報expected an indented block錯誤,偏偏英語有不好,就是沒看懂這段話。唉被催呀。後來一百度才知道是縮進問題。其實就是for循環下一句忘記了按tab建。
>>> a
[1, 2, 3, 4, 5]
>>> for i in a :
... print i
python繼續中。。。。