Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

# convert dictionary into list of tuples

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

Ouput:
[('apple', 1),
 ('oranges', 2),
 ('bananas', 3),
 ('grapes', 4),
 ('strawberries', 5),
 ('watermelon', 6)]
 
PREVIOUS NEXT
Tagged: #convert #dictionary #list #tuples
ADD COMMENT
Topic
Name
7+5 =