Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pair two lists into a dictionary

#Two lists
keys = ["Foo", "Bar", "Done"]
values = [1, 6, 9]
  
d = dict(zip(keys, values))
d
>>>{'Foo': 1, 'Bar': 6, 'Done': 9}
Comment

PREVIOUS NEXT
Code Example
Python :: extend a class python 
Python :: check if string is empty python 
Python :: Python NumPy swapaxis Function Example 2 
Python :: python random hash 
Python :: orderd set in python 
Python :: list comprehenstsion using lambda funcion 
Python :: np confidence interval 
Python :: append a zeros column numpy 
Python :: python tensorflow is not defined 
Python :: stack data horizontally pandas 
Python :: how to check if a list is a subset of another list 
Python :: matplotlib logarithmic scale 
Python :: how to rotate image in pygame 
Python :: how to get the type of a variable in python 
Python :: How to copy any text using python 
Python :: python version 
Python :: numpy roundup to nearest 5 
Python :: connecting python with database 
Python :: pickle load pickle file 
Python :: python get first n elements of dict 
Python :: returns the smallest positive integer python 
Python :: get all file in folder python 
Python :: view(-1) in pytorch 
Python :: accept user input in python 
Python :: extend tuple python 
Python :: find where df series is null and print 
Python :: if list of columns exist pandas 
Python :: numpy inverse square root 
Python :: python get stock prices 
Python :: py declare type list 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =