For your own notes. I haven't researched it thoroughly, so please let me know if you have any supplements or more useful ones!
dictionary = {'key1': [645, 469], 'key2': "value", 'key3': 3}
print (dictionary.keys())
dictionary = {'key1': [645, 469], 'key2': "value", 'key3': 3}
print (dictionary.values())
A list of key and value tuples will be returned.
dictionary = {'key1': [645, 469], 'key2': "value", 'key3': 3}
print (dictionary.items())
#-> [('key3', 3), ('key2', 'value'), ('key1', [645, 469])]
iteritems() It may be more convenient to use this method if you use a for statement.
dictionary = {'key1': [645, 469], 'key2': "value", 'key3': 3}
for key, value in dictionary.iteritems():
print "key:", key, "-- value:", value
Recommended Posts