CoCalc Public Filestmp / 2015-11-16-085109.sagewsOpen in with one click!
Authors: Harald Schilly, ℏal Snyder, William A. Stein
import csv import sys f = open('example.csv', 'wt') try: writer = csv.writer(f) writer.writerow( ('Title 1', 'Title 2', 'Title 3') ) for i in range(10): writer.writerow( (i+1, chr(ord('a') + i), '08/%02d/07' % (i+1)) ) finally: f.close() print open('example.csv', 'rt').read()
Title 1,Title 2,Title 3 1,a,08/01/07 2,b,08/02/07 3,c,08/03/07 4,d,08/04/07 5,e,08/05/07 6,f,08/06/07 7,g,08/07/07 8,h,08/08/07 9,i,08/09/07 10,j,08/10/07