events = []
for line in lines:
    if is_event(line):
        events.append([])
events[-1].append(line)

def is_event(line):
    return 'event' in line
How to collect data from a list into groups based on condition?