This should be a pretty straightforward python question, but I'm stuck getting the syntax right.
Let's say I have a line:
"1:a,b,c::2:e,f,g::3:h,i,j"
and I want to convert it to a map like this:
{'1': ['a', 'b', 'c'], '2': ['e', 'f', 'g'], '3': ['h', 'i', 'j']}
How to do it?
I can figure out how to do this using nested loops, but it would be great to just do it on one line.
Thank!
Peter source
share