import csv def readFile(f): """read a CSV file""" headers = [] rows = [] f = csv.reader(f) headers = f.next() for line in f: rows.append(line) return (headers, rows) def writeFile(data): writer = csv.writer(open("export.csv", "wb")) writer.writerows(data)