[newbie] Strange behavior of the re module
Sion Arrowsmith
siona at chiark.greenend.org.uk
Mon Aug 23 11:58:00 EDT 2004
Fred <fred at acme.com> wrote:
>output = re.sub('</body>', body, output)
Here's another hint: string.replace() is a lot faster than re.sub(),
and doesn't require any extra escaping of the replacement string.
Regular expressions are a bit of a Swiss Army knife in Python.
They'll do the job, but the proper tool will do it better.
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list