Can python read up to where a certain pattern is matched?
jcarlson at nospam.uci.edu
Tue Mar 9 05:11:16 CET 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.
More information about the Python-list