search file for tabs

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Tue May 2 21:47:55 EDT 2006


Tim Chase a écrit :
(snip)
> If you were using strip() to get rid of the newlines, you can easily 
> enough do that with
> 
>     text = text[:-1]

Which is a very bad idea IMHO.

> Or, depending on what your needs are, rstrip() may do the trick for you.

... eventually with it's optional param:

text = text.rstrip('\n')



More information about the Python-list mailing list