def get_text_blocks(filename):
    import itertools
with open(filename, 'r') as f:
    groups = itertools.groupby(f, lambda line: line.startswith('-- -'))
return [''.join(lines) for is_separator, lines in groups if not is_separator]
Как проверить EOF в Python?