- pluto.tools.parse_header_comments(filename, comment_char='#')¶
Parse a file with comments in its header to return the comments and the line number to start reader from.
filename (str) – path to input file
comment_char (str) – comment character
list – a list of comment lines from the file header
int – the line number on which file data starts (the line after the last comment)
comments, start_line = parse_header_comments(filename) with open(portal_file) as fin: while start_line > 0: next(fin) start_line -= 1 reader = csv.DictReader(fin, delimiter = ' ') # header_line = next(fin) portal_lines = [ row for row in reader ]