Looking for some help creating a dictionary in Python from a CSV.
E.g. going from
"'A', 'B', 'C', 'D'", "[['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h']], [['i']], [['jkl']]"
"'E', 'F', 'G'"," [['m']], [['n', 'o']], [['p', 'q'], ['r', 's'], ['t', 'u', 'v']]"
to
{('A', 'B', 'C', ' D') : [['a', 'b', 'c'], ['d', 'e'], ['f', 'g', 'h']] ...,
('E', 'F', 'G') : [['m']], ... }
I can open the file and do a .readlines pass on it fine.
I can strip the line feeds inherent in a CSV using .replace
But I can't figure out how to get the first item of each line of the CSV into a tuple and the second into a list. Just about everything I've tried seems to convert the parts into strings, which I can't figure out how to un-convert.
Any ideas?
Keep in mind I am at best a novice programmer. I've looked at e.g. https://www.geeksforgeeks.org/python-convert-a-list-to-dictionary/ and not been able to figure out how to get from their examples to what I need for this particular project.
#Coding #Help