FWIW, here is an generator version written without the state flag:

    def iter_block(lines, start_marker, end_marker):
        lines = iter(lines)
        for line in lines:
            if line.startswith(start_marker):
                yield line
                break
        for line in lines:
            if line.startswith(end_marker):
                return
            yield line

Raymond
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to