Can python read up to where a certain pattern is matched?
Andrew Bennetts
andrew-pythonlist at puzzling.org
Sat Mar 6 18:40:44 EST 2004
On Sat, Mar 06, 2004 at 10:57:27AM -0800, Josiah Carlson wrote:
> >Note that I've only lightly tested that code, and it's probably very
> >inefficient.
>
> It is all right except for the string addition. Each addition produces
> a new string. For a final string of length n, you will have created n
> strings, and had to write n*(n-1)/2 = O(n^2) bytes. Ick.
That, and I suspect that reading strings in chunks, rather than 1 byte at a
time, would be much faster also.
-Andrew.
More information about the Python-list
mailing list