Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python too many values to unpack

Usually happens with dicts.
hydrogen = {
	"name": "Hydrogen",
	"atomic_weight": 1.008,
	"atomic_number": 1
}

This does not raise an error:
for key, value in hydrogen.items():
	print("Key:", key)
	print("Value:", str(value))

You have to do hydrogen.items() in order to access the keys and values.
Otherwise it will return an error.
Source by careerkarma.com #
 
PREVIOUS NEXT
Tagged: #python #values #unpack
ADD COMMENT
Topic
Name
9+9 =