Answers for "make a list from a some items from a dictionary python"

0

lists to dictionary python

#This is to convert two lists into a dictionary in Python

#given ListA is key
#given ListB is value

listA = ['itemA','itemB']
listB = ['priceA','priceB']
dict(zip(listA, listB))

# Returns 
{'itemA': 'priceA',
 'itemB': 'priceB'
}
Posted by: Guest on November-21-2021

Code answers related to "make a list from a some items from a dictionary python"

Python Answers by Framework

Browse Popular Code Answers by Language