diff --git a/process b/process new file mode 100755 index 0000000..c3008dd --- /dev/null +++ b/process @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import sys +import csv + +# Strip whitespace left and right of a string +def strip(s: str): + return s.rstrip().lstrip() + +def main(): + filepaths = sys.argv[1:] + print(f'{filepaths=}') + + delim=',' + quotechar='"' + + for file in filepaths: + with open(file, newline='') as csvfile: + reader = csv.reader(csvfile, delimiter=delim, quotechar=quotechar, skipinitialspace=True) + next(reader) # Skip the first row + for row in reader: + stripped = map(strip, row) + [keyword, text, sound] = stripped + print(keyword, text, sound) +main()