27 lines
705 B
Python
Executable File
27 lines
705 B
Python
Executable File
#!/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:
|
|
# Strip any whitespace in the csv file
|
|
stripped = map(strip, row)
|
|
[keyword, text, sound] = stripped
|
|
print(f'{keyword},{text},{sound}')
|
|
main()
|