Commit d48db423 authored by Neeme Kahusk's avatar Neeme Kahusk

csv_out

parent 49baed67
......@@ -59,9 +59,18 @@ def featured_rows(list_of_roots: list, labels: list):
return out
def csv_out(outfilename: str, data: list, headers: list):
with open(outfilename, 'w') as outfile:
writer = csv.DictWriter(outfile, headers, dialect=csv.excel_tab, extrasaction='ignore')
writer.writeheader()
for i in data:
writer.writerow(i)
def main():
parser = argparse.ArgumentParser(description='Avab zip faili')
parser.add_argument('infile')
parser.add_argument('outfile')
parser.add_argument('-t', '--tablefile')
parser.add_argument('-x', '--xpath')
parser.add_argument("-z", "--zip", action="store_true")
......@@ -74,8 +83,16 @@ def main():
tulem = zip2roots(args.infile)
tulemitabel = featured_rows(tulem, labels)
for i in tulemitabel:
print(i)
# for i in tulemitabel:
# print(i)
#
# with open(outfilename, 'w') as outfile:
# writer = csv.DictWriter(outfile, headers, dialect=csv.excel_tab, extrasaction='ignore')
# writer.writeheader()
# for i in data:
# writer.writerow(i)
csv_out(args.outfile, tulemitabel, SIMPLE)
else:
p = Path(args.infile)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment