Here's the list I'm trying to convert (arbitrary numbers):
[['2 4', '18', '4', '32', '2'], ['2 4', '13', '9', '12', '4'], ['3 7', '435', '2
3', '123', '4', '3', '234', '34']]
And here is the dictionary it returns (close, but not quite). Notice how the values are out of order. I need them to be in the same order as the list:
{0: {'2': 0, '18': 0, '32': 0, '2 4': 0, '4': 0}, 1: {'9': 0, '13': 0, '12': 0,
'2 4': 0, '4': 0}, 2: {'23': 0, '34': 0, '3': 0, '123': 0, '4': 0, '234': 0, '43
5': 0, '3 7': 0}}
And finally, here is the code I'm using to convert it:
iterator = 0
myDict = {}
for listItem in myList:
for item in listItem[1:]:
myDict[iterator] = dict.fromkeys(listItem, 0)
iterator +=1
edit: I forgot to mention that I'm trying to cut the first item in each list out of its corresponding dictionary.