HELP: String manipulation question from a newbie

Grant Edwards ge at nowhere.none
Thu Aug 17 11:19:56 EDT 2000


In article <399ABB08.85FF4B12 at VerizonWireless.com>, Bill Scherer wrote:

>> find the first occurrence of the substring "body_" in a string
>> (called URL) and strip it out,

>import string
>URL = string.replace(URL, 'body_', '')
>
>will do it.

He only wanted to replace the first occurrence. string.replace()
replaces all occurrences.

-- 
Grant Edwards                   grante             Yow!  Yow! Is this sexual
                                  at               intercourse yet?? Is it,
                               visi.com            huh, is it??



More information about the Python-list mailing list