I have the following list that I want to convert to a dictionary.
newData = ['John', 4.52, 'Jane', 5.19, 'Ram', 4.09, 'Hari', 2.97, 'Sita', 3.58, 'Gita', 4.1]
I want to create a dictionary like this:
newDict = [{'name': 'John', 'Height': 4.52}, {'name': 'Jane', 'Height': 5.19}, {'name': 'Ram', 'Height': 4.09}, {'name': 'Hari', 'Height': 2.97}, {'name': 'Sita', 'Height': 3.58}, {'name': 'Gita', 'Height': 4.1}]
What would be the easiest way to do this?
source share