Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

# convert dictionary keys to a list

#Convert a dictionary keys to a list:
d3 = {'apple': 1, 'oranges': 2, 'bananas': 3, 'grapes': 4, 'strawberries': 5, 'watermelon': 6}
list(d3.keys())

['apple', 'oranges', 'bananas', 'grapes', 'strawberries', 'watermelon']

d3 = {'apple': 1, 'oranges': 2, 'bananas': 3, 'grapes': 4, 'strawberries': 5, 'watermelon': 6}
list(d3.values())

[1, 2, 3, 4, 5, 6]
 
PREVIOUS NEXT
Tagged: #convert #dictionary #keys #list
ADD COMMENT
Topic
Name
3+5 =