[newbie] Strange behavior of the re module

Fred fred at acme.com
Mon Aug 23 20:26:05 EDT 2004


On 23 Aug 2004 16:58:00 +0100 (BST), Sion Arrowsmith
<siona at chiark.greenend.org.uk> wrote:
>Here's another hint: string.replace() is a lot faster than re.sub(),
>and doesn't require any extra escaping of the replacement string.

Indeed. The replacing line on the same 200KB document takes over
2:30mn using re.sub() but... less than a secod with output.replace().

Thx a bunch for the tip :-)
Fred.



More information about the Python-list mailing list