iterator/generator
Patrick Maupin
pmaupin at gmail.com
Sun Mar 14 22:07:41 EDT 2010
First of all, as Steve Holden mentioned, do look at xlrd. It's
awesome.
Second, for your (a) question, if you want an iterator, that's quite
easy:
matriz = iter(matriz)
matriz.next() # Discard the first one
for i in matriz:
This technique works really well, especially if you have sub-loops.
Then, if you use a defaultdict which uses a list for a constructor
for i in matriz:
if i[a] and i[b]:
g[i[a]].append(i[b])
HTH,
Pat
More information about the Python-list
mailing list