Created
December 18, 2014 01:00
-
-
Save aaronr/f04c5a18e1f2cc506cb5 to your computer and use it in GitHub Desktop.
csv writer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import csv | |
extra = [ | |
'extra_column', | |
] | |
csvfile = open(os.path.join(options.output_directory,options.output_name+'.csv'), "wb") | |
writer = csv.writer(csvfile, delimiter=',') | |
header = ['id','Longitude','Latitude','path'] | |
# add extra headers if needed | |
header.extend(extra) | |
writer.writerow(header) | |
row = [str(id),str(lon),str(lat),str(path)] | |
# add extra data if extra headers where used | |
row.extend(extra_out) | |
writer.writerow(row) | |
csvfile.flush() | |
csvfile.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment