Problem with python

Lie Lie.1296 at gmail.com
Sun Mar 30 08:45:25 EDT 2008


mac_the_sco... at hotmail.com wrote to me:
(snip)
> OK thanks mate you're the man :)
> One more question though :P
> If I write a python script in a text editor (I use Programmers
> Notepad), how do I write indentations properly? e.g.:
> ---------------------------------------------------
> temperature = input("How hot is the spam? ")
> while temperature < hot_enough:
>    print "Not hot enough... Cook it a bit more..."
>    sleep(30)
>    temperature = input("OK. How hot is it now? ")
> print "It's hot enough - You're done!"
>
> (taken from hetland.org)
> ---------------------------------------------------
> Is it simply a case of hitting the spacebar until it looks right?

Yep, it's just a matter of hitting spacebar until it looks right, but
you should also be aware that the Python Interpreter doesn't like it
if you mix tabs and spaces, so make sure you only use either one of
them. As an additional note, Python's style guideline says you should
use 4 spaces (additionally, most Python IDEs automatically convert
tabs into 4 spaces for convenience and to avoid mixing tabs and
cases).

PS: I'll mirror this to comp.lang.python



More information about the Python-list mailing list