Add simple process script
This commit is contained in:
parent
b5341a04c7
commit
f5aca0d4cd
25
process
Executable file
25
process
Executable file
@ -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()
|
Loading…
Reference in New Issue
Block a user