Trying to convert a .tsv to a .csv. This:
import csv
# read tab-delimited file
with open('DataS1_interactome.tsv','rb') as fin:
cr = csv.reader(fin, delimiter='\t')
filecontents = [line for line in cr]
# write comma-delimited file (comma is the default delimiter)
with open('interactome.csv','wb') as fou:
cw = csv.writer(fou, quotechar='', quoting=csv.QUOTE_NONE)
cw.writerows(filecontents)
Gives me this error:
File "tsv2csv.py", line 11, in <module>
cw.writerows(filecontents)
_csv.Error: need to escape, but no escapechar set