[Csv] PEP 305

Skip Montanaro skip at pobox.com
Tue Apr 6 16:33:00 CEST 2004


    Shiva> how to generate empty csv files plz

An empty csv file would be either an empty file or a csv file with just a
line identifying the field headers.  For the former, just open and close a
file:

    file("empty.csv", "wb")

For the latter, just write the header row, e.g.:

    writer = csv.writer(file("empty.csv", "wb"))
    writer.writerow(("date", "city", "state", "performer", "venue"))
    del writer

Skip


More information about the Csv mailing list