HELP: String manipulation question from a newbie
Kalle Svensson
kalle at gnupung.net
Wed Aug 16 12:09:41 EDT 2000
On Wed, 16 Aug 2000 namking at my-deja.com wrote:
> find the first occurrence of the substring "body_" in a string (called
> URL) and strip it out,
>
> e.g. if URL="http://www.xxx.com/body_welcome.html" I want to change it
> to "http://www.xxx.com/welcome.html".
URL = string.replace(URL, "body_", "", 1)
For this to work, you have to import the string module somewhere in your
program, perhaps at the top (there should be a number of import statements
there already, just add the module "string").
HTH,
Kalle Svensson
--
Email: kalle at gnupung.net | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
More information about the Python-list
mailing list