String Handling

Bill Scherer scherbi at bam.com
Tue Jan 4 09:38:17 EST 2000


>>> import string
>>> replace = string.replace
>>> a = "Lucy by Railway Carraige"
>>> b = replace(a, " ", "+")
>>> b
"Lucy+by+Railway+Carraige"
>>>

- Bill

Simon Faulkner wrote:

> Hi All,
>
> Can anyone give me the Python line/command to change all spaces in a
> string to +s?
>
> ie
>
> "Lucy by Railway Carraige"
>
> becomes
>
> "Lucy+by+Railway+Carraige"
>
> Muchos gratcias etc
>
> Simon
> Simon Faulkner
> --
> http://www.python.org/mailman/listinfo/python-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scherbi.vcf
Type: text/x-vcard
Size: 226 bytes
Desc: Card for Bill Scherer
URL: <http://mail.python.org/pipermail/python-list/attachments/20000104/1b19f775/attachment.vcf>


More information about the Python-list mailing list