Deleting specific characters from a string

Fredrik Lundh fredrik at pythonware.com
Fri Jul 11 00:18:44 CEST 2003


Fredrik Lundh wrote:

> if you precompile the regexp, p.sub(text, "") is nearly as fast as the
> translate method under 2.3.  ymmv.

mmmv, too.  it's "p.sub("", text)", and it was a (different) flaw in
my test script.  if you want performance, use "translate".

</F>








More information about the Python-list mailing list