On Apr 30, 2:00 pm, 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
Sneaky Wombat writes:
> I'm really confused by what is happening here. If I use zip(), I
> can't update individual dictionary elements like I usually do. It
> updates all of the dictionary elements. It's hard to explain, so here
> is some output from an interactive session:
>
> In [52]: header
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
Thanks! That certainly explains it. This works as expected.
columnMap={}
for (k,v) in zip(header,[[] for i in range(len(header))]):
#print "%s,%s"%(k,v)
columnMap[k] = v
columnMap['a'].append('test')
(sorry about the double post, accidental browser refresh)
On Apr 30, 1:09 pm, Chris
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
> On Apr 30, 12:45 pm, Sneaky Wombat <> wrote:
>> I'm really confused by what is happening here. If I use zip(), I
>> can't update individual dictionary elements like I usually do. It
>> updates all of the dictionary elements. It's hard to explain, so here
>> is some output from an interactive s
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