[Tutor] for k,v in d: ValueError: too many values to unpack

John Washakie washakie at gmail.com
Mon May 21 23:53:17 CEST 2007


I have a Dictionary, that is made up of keys which are email
addresses, and values which are a list of firstname, lastnamet,
address, etc...

If I run the following:

#! /bin/python

import csv

last = {}
rdr = csv.DictReader(file("reg-data.csv"))
for row in rdr:
	#print row
	last[row["reg-email"]] =
[row["reg-last"],row["reg-first"],row["reg-country"],row["reg-address"],row["reg-institution"],row["reg-phone"],row["reg-subject"],row["reg-abstract"],row["reg-category"],row["reg-speaking"],row["reg-travel"],row["reg-abstract-upload"],row["reg-rec"]]

print last['jfb at nilu.no'][0]
#	print records

for k,v in last:
	print "Email: %s , has the Last name: %s" % (k,v[0])

I get the error indicated in the subject:
ValueError: too many values to unpack

Any ideas? Thanks!


More information about the Tutor mailing list