def writeCSV ( data , headers , csvFile ) : with open ( csvFile , "wb" ) as f : writer = csv . writer ( f , delimiter = "," ) writer . writerow ( headers ) writer . writerows ( data )
add a header to a csv in python
Write data with column headers to a CSV .
def writeCSV(data, headers, csvFile):
  """Write data with column headers to a CSV."""
  with open(csvFile, "wb") as f:
    writer = csv.writer(f, delimiter=",")
    writer.writerow(headers)
    writer.writerows(data)