Interactive mode under DOS?
Peter Otten
__peter__ at web.de
Sun Oct 24 07:15:59 EDT 2010
huisky wrote:
> Hi,
>
> I'm trying to use the interactive mode under DOS for Python 2.7. As a
> newbie, I do NOT know what is the following problem:
>
>>>>world_is_flat=1
>>>>if world_is_flat:
> . . . print "be carefule to be not fall out!"
> File "<stdin>", line 2
> print "be carefule to be not fall out!"
> ^
> IndenatationError : expected an idented block
>>>>
>
> Enybody knows how to fix this simple issue?
>
> regards
The lines that shall be executed when world_is_flat is True must be indented
more than the if. If you don't follow this rule Python complains and raises
an IndentationError.
>>> if world_is_flat:
... print "be careful"
File "<stdin>", line 2
print "be careful"
^
IndentationError: expected an indented block
The easiest way to indent in interactive mode is to hit TAB once:
>>> if world_is_flat:
... print "be careful"
...
be careful
By the way, you should not retype your error messages because that is error
prone. Instead cut and paste. I think there is an entry in the system menu
of the dos window to help you do that.
Peter
More information about the Python-list
mailing list