I am using this pdf to csv function from {Python module for converting PDF to text} and I was wondering how can I now export the result to a csv file on my drive? I tried adding in the function
with open('C:\location', 'wb') as f:
writer = csv.writer(f)
for row in data:
writer.writerow(row)
but the resulting csv file has one character per row and not the rows I have when printing data in python.
data? If it's a string, you are just iterating over characters and indeed writing one character per line.lines=data.split("\n"). Additionaly, you have to pass a sequence towriter.writerow. See docs.python.org/3.4/library/csv.html#writer-objectswith open('C:\location', 'wb') as f: