["python"]
'too many values to unpack', iterating over a dict. key=>string, value=>list

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
Python 3 Use items(). for field, possible_values in fields.items(): print(field, possible_values) Python 2 Use iteritems(). for field, possible_values in fields.iteritems(): print field, possible_values See this answer for more information on iterating through dictionaries, such as using items(), across Python versions. For reference, iteritems() was removed in Python 3.