Can python read up to where a certain pattern is matched?
Josiah Carlson
jcarlson at nospam.uci.edu
Mon Mar 8 23:11:16 EST 2004
> That, and I suspect that reading strings in chunks, rather than 1 byte at a
> time, would be much faster also.
Yes and no. string.find(character) is fast.
seq = [read_chars.find(i) for i in break_characters]
min(filter(lambda inp:inp>-1, seq)+[-1])
May not be quite so fast for large numbers of break characters.
- Josiah
More information about the Python-list
mailing list