How to convert " " in a string to blank space?

Gary Herron gherron at islandtraining.com
Mon Oct 30 18:37:54 CET 2006


一首诗 wrote:
> Is there any simple way to solve this problem?
>
>   
Yes, strings have a replace method:

>>> s = "abc def"
>>> s.replace(' ',' ')
'abc def'

Also various modules that are meant to deal with web and xml and such
have functions to do such operations.


Gary Herron






More information about the Python-list mailing list