Mike P wrote:
I'm trying to use the CSV module to read in some data and then use a
hashable method (as there are millions of records) to find unique ids
and push these out to another file,

You could either zip with a counter or use the uuid module,
depending on just how unique you want your ids to be.

<code>
import os, sys
import csv
import itertools
import uuid

stuff = "the quick brown fox jumps over the lazy dog".split ()

f = open ("output.csv", "wb")
writer = csv.writer (f)

#
# Style 1 - numeric counter
#
writer.writerows (zip (itertools.count (), stuff))

#
# Style 2 - uuid
#
writer.writerows ((uuid.uuid1 (), s) for s in stuff)

f.close ()
os.startfile ("output.csv")

</code>

TJG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to