String replace with return value?
moof at boof.moof
Mon Oct 11 11:47:48 CEST 2004
How can I do a "".replace operation which tells me if anything was
Right now I am doing something like:
if searchTerm in text:
text = text.replace( searchTerm, 'other' )
But to me this seems inefficient since the 'in' operation will search
through the whole string, and then the 'replace' will as well.
The strings are quite large, they're whole web pages. Thanks for any help.
More information about the Python-list