Sneaky Wombat wrote:
quick update,
#change this line:
for (k,v) in zip(header,[[]]*len(header)):
#to this line:
for (k,v) in zip(header,[[],[],[],[]]):
and it works as expected. Something about the [[]]*len(header) is
causing the weird behavior. I'm probably using it wrong, but if
anyone can explain why that would happen, i'd appreciate it.
I'll bet the output below explains it:
header = 'a', 'b', 'c', 'd'
print [id(x) for x in [[]] * len(header)]
print [id(x) for x in [[],[],[],[]]]
and (what I think you want):
print [id(x) for x in [[] for x in header]]
So, I think you should use:
columnMap = dict(zip(header, ([] for x in header)))
--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list