Commit 7a11b998 authored by Neeme Kahusk's avatar Neeme Kahusk

puhtamaks ja doc

parent 9453afd8
......@@ -57,6 +57,14 @@ def featured_rows(list_of_roots: list, labels: list):
def csv_out(outfilename: str, data: list, headers: list):
"""Writes out to csv list that consists of dicts, where each key is column header
and value column value. Uses csv.DictWriter.
:param outfilename: CSV file name
:param data: list of dicts to write to csv
:param headers: list of column headers
:return: None
with open(outfilename, 'w') as outfile:
writer = csv.DictWriter(outfile, headers, dialect=csv.excel_tab, extrasaction='ignore')
......@@ -65,12 +73,11 @@ def csv_out(outfilename: str, data: list, headers: list):
def main():
parser = argparse.ArgumentParser(description='Avab zip faili')
parser = argparse.ArgumentParser(description='Converts resource description(s) from xml file(s) to csv file.')
parser.add_argument('-t', '--tablefile')
parser.add_argument('-x', '--xpath')
#parser.add_argument("-z", "--zip", action="store_true")
#parser.add_argument('-t', '--tablefile')
#parser.add_argument('-x', '--xpath')
args = parser.parse_args()
......@@ -88,7 +95,5 @@ def main():
tulemitabel = featured_rows(tulem, labels)
csv_out(args.outfile, tulemitabel, SIMPLE)
if __name__ == '__main__':
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