I open a csv file and create a DictReader object. Subsequently, reading lines from this file I try to update a dictionary of lists:

csvf=open(os.path.join(root,fcsv),'rb')
csvr=csv.DictReader(csvf)
refd=dict.fromkeys(csvr.fieldnames,[])
for row in csvr:
    for (k,v) in row.items():
          refd[k].append(v)

I do not understand why this appends v to every key k each time.

Thanks in advance for any tips you can pass on.

Alex van der Spek
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to