Source Code:
(back to article)
# Create a sample dictionary my_dict = {'a': 1, 'b': 2, 'c': 3} # Using list comprehension keys_list = [key for key in my_dict] print(keys_list) # Output: ['a', 'b', 'c']
Result:
Report an issue