want to do: dict = {'1': ['a'],'2': ['a', 'b', 'c']}
invert it to: inv_dict = {'a':['1','2'],'b':['2'],'c':['2']}
i know the one liner, if the dict was one to one, inverse = dict((d[k], k) for k in d)
can I modify this to work if it was not one to one?
My original attempt: tried to get all of the values from the dict and made it a list then deleted duplicates, using set, then compared original dict keys to check if the certain value existed in that key, if true then change the key in list and append. I can post the code, if needed? Any other suggested way? I feel there has to be a easier way than this.