transformer un dictionnaire en liste python

Solutions on MaxInterview for transformer un dictionnaire en liste python by the best coders in the world

showing results for - "transformer un dictionnaire en liste python"
Fenton
31 Jul 2016
1# A list of the keys of dictionary
2list_keys = [ k for k in dict ]
3 
4# or a list of the values
5list_values = [ v for v in dict.values() ]
6 
7# or just a list of the list of key value pairs
8list_key_value = [ [k,v] for k, v in dict.items() ]