Posted By

GabrielTheodoulos on 07/20/16


Tagged

list dictionary


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BigD3m0n


Dictionary Values to a List


 / Published in: Python
 

URL: http://stackoverflow.com/questions/38319568/how-do-i-make-a-list-out-of-data-derived-from-a-dictionary/38319779#38319779

This shows how to convert values from a dictionary and make them a list.

  1. data = {'Ken':89, 'John': 92, 'Sue':95, 'Karen':78} #Sets up our Dictionary
  2.  
  3. your_list = list(data.values())
  4. # (don't use 'list' as the variable name
  5. # since it's already a standard function)
  6.  
  7. print(your_list)
  8. # [89, 92, 95, 78]

Report this snippet  

You need to login to post a comment.