Deleting specific characters from a string

Fredrik Lundh fredrik at pythonware.com
Thu Jul 10 18:18:44 EDT 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