Answers for "python list of lists into a dict"

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 "python list of lists into a dict"

Python Answers by Framework

Browse Popular Code Answers by Language