[Tutor] What's an IndentationError & How Do I Fix It

Steven D'Aprano steve at pearwood.info
Sat Mar 12 17:32:23 CET 2011


Dorje Kawabata wrote:

> IndentationError: expected an indented block
> 
> I'm learning python as my first language since coding Basic in 6th grade
> (over 30 years ago). I assume that in a text editor I would simply indent
> the code.
> 
> *My question is how do I fix this in the interpreter? What do I type?*

The same thing you would type in an editor: the tab key.

Or if you prefer, you can type 4 spaces (or 8, so long as it is 
consistent) instead.


-- 
Steven



More information about the Tutor mailing list