I writing some unicode output to csv using the unicodecsv module. Everything is working as expected, but I'm trying to build it out by adding some headers or field names. So far, I've tried a number of different ways, but I can't come up with how to add the field names.
I've tried other unicode solutions and this module seems to be the most elegant to implement so I'm trying to use it if possible. If there are other suggestions, I'm up for them. Any ideas?? Please see relevant code below.
import unicodecsv
with open('c:\pull.csv', 'wb+') as f:
csv_writer = unicodecsv.writer(f, encoding='utf-8')
for i in changes['user']['login'], changes['title'], str(changes['changed_files']), str(changes['commits']) :
csv_writer.writerow([changes['user']['login'], changes['title'],changes['changed_files'], changes['commits']])
Sample output for changes in the csv file:
'John Doe', 'Some Title', 1, 1
changes. Also what headers do you want to add?changeswould containe?