Search
 
SCRIPT & CODE EXAMPLE
 

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)]
Comment

PREVIOUS NEXT
Code Example
Python :: write list to file python 
Python :: Python Tkinter SpinBox Widget 
Python :: python set and dictionary comprehensions 
Python :: twitter bot python 
Python :: How to generate all the permutations of a set of integers, in Python? 
Python :: python delete text in text file 
Python :: Adjusting Subplot Margins in Matplotlib 
Python :: python unzip list of tuples 
Python :: how to delete a file in python 
Python :: keras.layers.simplernn 
Python :: registration of path in urls.py for your apps for views 
Python :: numpy round to int 
Python :: application/x-www-form-urlencoded python 
Python :: remove unnamed 0 column pandas 
Python :: scipy euclidean distance 
Python :: Create list with numbers between 2 values by 
Python :: spacy config 
Python :: get just filename without extension from the path python 
Python :: elon musk wikipedia 
Python :: find duplicates in python list 
Python :: how to download instagram profile picture with the help of python 
Python :: change dataframe value by index 
Python :: python class 
Python :: python get file path 
Python :: number of words in a string python 
Python :: check if host is reachable python 
Python :: python update multiple dictionary values 
Python :: simple secatter plot 
Python :: ion flux relabeling 
Python :: matplotlib to pdf 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =