compound strip() string problem
Tony Meyer
t-meyer at ihug.co.nz
Sun Apr 10 22:17:05 EDT 2005
> 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())
Alternatively, you could do something like:
import string
for c in string.whitespace:
mystring = mystring.replace(c, "")
Not as good if you want to remove all whitespace from the string, but it
looked like the OP only really had spaces, so a simple
mystring=mystring.replace(' ', '') would be the clearest (and fastest).
=Tony.Meyer
More information about the Python-list
mailing list