I am getting the 'too many values to unpack'
error. Any idea how I can fix this?
first_names = ['foo', 'bar']
last_names = ['gravy', 'snowman']
fields = {
'first_names': first_names,
'last_name': last_names,
}
for field, possible_values in fields: # error happens on this line
Best Answer
Python 3
Since Python 3
iteritems()
is no longer supported. Useitems()
instead.Python 2
You need to use something like
iteritems
.See this answer for more information on iterating through dictionaries, such as using
items()
, across python versions.