Created
March 10, 2018 16:13
-
-
Save elfosardo/2cfb43c25ee3353813dafbbea9b93486 to your computer and use it in GitHub Desktop.
[python] convert dictionary to list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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