What is built-in method sub

Stephen Hansen apt.shansen at gmail.com
Mon Jan 11 15:29:37 EST 2010


On Mon, Jan 11, 2010 at 12:02 PM, Jeremy <jlconlin at gmail.com> wrote:

> Your guess is correct.  I had forgotten that I was using that
> function.
>
> I am using the re.sub command to remove trailing whitespace from lines
> in a text file.  The commands I use are copied below.  If you have any
> suggestions on how they could be improved, I would love to know.
>
>
Just use line.rstrip().. Regular expressions are almost always slower then
just calling string methods for simple operations.

HTH,
--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100111/7289edf5/attachment-0001.html>


More information about the Python-list mailing list