Double replace or single re.sub?
EP
eric.pederson at gmail.com
Thu Oct 27 15:39:18 EDT 2005
How does Python execute something like the following
oldPhrase="My dog has fleas on his knees"
newPhrase=oldPhrase.replace("fleas",
"wrinkles").replace("knees","face")
Does it do two iterations of the replace method on the initial and then
an intermediate string (my guess) -- or does it compile to something
more efficient (I doubt it, unless it's Christmas in Pythonville... but
I thought I'd query)
More information about the Python-list
mailing list