compound strip() string problem

Jeffrey Froman jeffrey at fro.man
Fri Apr 8 10:44:52 EDT 2005


Dylan Wilson wrote:

> Now i need to compond that string remove the whitespace if you will.Well
> i read up on strip(), lstrip() and rstrip() and all i could deduce was
> that they striped the whitespace from the start and/or end of the
> string.But I tried that anyway and failed.Is there an easier way than i
> did it below?

As Sidharth Kuruvila pointed out, time.strftime() is probably the best
choice for your situation. For the general case of removing whitespace from
a sting, one method is:

''.join(mystring.split())


Jeffrey



More information about the Python-list mailing list