Python Indentation Problems

bruno at modulix onurb at xiludom.gro
Tue Feb 28 04:05:00 EST 2006


diffuser78 at gmail.com wrote:
> I am a newbie to Python. I am mainly using Eric as the IDE for coding.
> Also, using VIM and gedit sometimes.
> 
> I had this wierd problem of indentation. My code was 100% right but it
> wont run because indentation was not right. 

If indentation is not right, then your code is not 100% right !-)

> I checked time and again
> but still no success. I rewrote the code over again in VI and it ran.
> 
> Can you please explain whats the trick behind the correct indentation.

1/ use spaces not tabs. Hint : all decent code editors I know have a way
to configure this - just make sure all the editors you use have the
correct settings.
2/ preferably, stick to 4 spaces indent
3/ if you run into troubles, check the code with tabnanny:
http://effbot.org/librarybook/tabnanny.htm


> Thanks
> 


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list