1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
import csv
csvFile = open("test.csv", 'w+') try: writer = csv.writer(csvFile) writer.writerow(('number', 'number plus 2', 'number times 2')) for i in range(10): writer.writerow( (i, i+2, i*2)) finally: csvFile.close()
|