Dec-27-2019, 02:15 PM
(This post was last modified: Dec-27-2019, 02:15 PM by Gribouillis.)
Here is the modified parse_file() that skips the lines before the first TABLE:
def parse_file(infile): parsed_file = [] sequence = table_data_lines(infile) # find first line starting with TABLE: for lineno, line in sequence: if line.startswith('TABLE:'): break else: return parsed_file table_name = line[6:].strip().strip('"') while table_name: table_name = read_table(table_name, sequence, parsed_file) return parsed_fileIt is important that you try to parse several input files in order to discover potential issues that we haven't seen yet in the parsing phase.