how to avoid leading white spaces

MRAB python at mrabarnett.plus.com
Thu Jun 2 22:41:47 EDT 2011


On 03/06/2011 02:57, Roy Smith wrote:
> In article<94ph22FrhvU5 at mid.individual.net>,
>   Neil Cerutti<neilc at norwich.edu>  wrote:
>
>> On 2011-06-01, rurpy at yahoo.com<rurpy at yahoo.com>  wrote:
>>> For some odd reason (perhaps because they are used a lot in
>>> Perl), this groups seems to have a great aversion to regular
>>> expressions. Too bad because this is a typical problem where
>>> their use is the best solution.
>>
>> Python's str methods, when they're sufficent, are usually more
>> efficient.
>
> I was all set to say, "prove it!" when I decided to try an experiment.
> Much to my surprise, for at least one common case, this is indeed
> correct.
>
[snip]

I've tested it on my PC for Python 2.7 (bytestring) and Python 3.1
(Unicode) and included the "regex" module on PyPI:

Python 2.7:
0.949936333562
4.31320052965
1.14035334748

Python 3.1:
1.27268308633
4.2509511537
1.16866839819



More information about the Python-list mailing list