4 def is_comment(list_values, comment_char = "#"):
5 if(len(list_values) == 0
or list_values[0][0] == comment_char):
9 def read_csv(fn, delimiter = "|", comment_char = "#", max_number=False):
11 Simple reader of csv files that disregards lines with comments
14 reader = csv.reader(f, delimiter=delimiter)
24 rows = [d
for d
in reader if(
not is_comment(d, comment_char))]
29 def read_csv_keyword(fn_or_f,keyword, delimiter = "|",
32 Reader of csv files that only recovers lines starting with a keyword
35 if(type(fn_or_f) == str):
36 f = open(fn_or_f,
"r")
37 elif(type(fn_or_f) == file):
40 reader = csv.reader(f, delimiter=delimiter)
43 if(
not is_comment(row)
and row[0] == keyword):
47 if(type(fn_or_f) == str):