Hi I am new to python and I want to write a program which will read the csv file and write the data to another file.
Below is the code:
#!/usr/bin/python
import csv
FEED_FILE = '/proj/ctc/temp/sanjay/REC-754/20170529_MUREX_EOD_REC_RATES_20170531.csv'
OUT_FILE = '/proj/ctc/temp/sanjay/REC-754/20170529_MUREX_EOD_REC_RATES_20170531_out.csv'
with open(OUT_FILE, 'w', newline='') as outputfile:
with open(FEED_FILE, newline='') as feed:
writer = csv.writer(outputfile, delimiter=',', quotechar='"')
reader = csv.reader(feed, delimiter=',', quotechar='"')
for row in reader:
row[3] = sorted(list(row[3].split(','))
writer.writerow(row)
but I am getting below error, which I am not able to understand why?
$./Csvreader.py
File "./Csvreader.py", line 14
writer.writerow(row)
^
SyntaxError: invalid syntax
Please help me with the solution, thanks in advance.
sorted(...