Skip to content

Instantly share code, notes, and snippets.

@elfosardo
Created March 10, 2018 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfosardo/2cfb43c25ee3353813dafbbea9b93486 to your computer and use it in GitHub Desktop.
Save elfosardo/2cfb43c25ee3353813dafbbea9b93486 to your computer and use it in GitHub Desktop.
[python] convert dictionary to list
# A list of the keys of dictionary
list_keys = [ k for k in dict ]
# or a list of the values
list_values = [ v for v in dict.values() ]
# or just a list of the list of key value pairs
list_key_value = [ [k,v] for k, v in dict.items() ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment