Python學習小記:IndentationError: expected an indented block

使用cmd編寫python,遇到 「IndentationError: expected an indented block」 的錯誤,原因是:沒有縮進!!! 如圖,對於for循環下面的print,在…後面應該用tab鍵縮進可以。Python對於縮進十分敏感,一旦錯誤,會發生不可預估的後果。 縮進後就可以得到正確的結果了。
相關文章
相關標籤/搜索