@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 1657 / 12833)
Get All Values by Using values()
I've tried.
http://ideone.com/LATO2j
mydic = {'7of9' : 'borg', 'Chakotay' : 'human', 'Janeway' : 'human'}
print(mydic.values())
Operating environment
['human', 'borg', 'human']
It can be seen from the above that the value obtained by values () is different from the order at the time of setting, probably because the order of the pair to be set is not retained in the case of dictionary.
http://ideone.com/DRpIPQ
mydic = {'a' : 'zun', 'b' : 'zun', 'c': 'zun', 'd' : 'doko', 'e' : 'zun' }
print(mydic.values())
print('KIYOSHI!')
result
Success time: 0.01 memory: 23352 signal:0
['zun', 'zun', 'zun', 'zun', 'doko']
KIYOSHI!
Recommended Posts