Strip White spaces

Hello All,

I am trying to strip white spaces out of a html file or a very long
string and am coming up a blank. Does anyone have some suggestions as
to how to tackle this?



I am sure there is a more elegant solution but I think the following
could work:

your_string.squeeze(" ").split(" ").join

what about


almes wrote:

Thanks for your reply but I can not use split because there is HTML
mark-up in the document that I wish to parse.

The problem with this approach is that it removes all spaces form the
document, which is not my intention. I wish to remove all white
spaces from the document while retaining all spaces between words.
Does anybody know how to do this?

My mistake. this works great.

Thank you for your help.