Source Code:
(back to article)
# Initialize a dictionary my_dict = {'a': 1, 'b': 2, 'c': 3} # Convert to a list of keys keys_list = list(my_dict.keys()) print(keys_list) # Output: ['a', 'b', 'c'] # Convert to a list of values values_list = list(my_dict.values()) print(values_list) # Output: [1, 2, 3]
Result:
Report an issue