0

I'm confident there's a succinct pythonic way to convert:

[('a', 1), ('a', 2), ('b', 4)]

Into:

{'a':[1, 2], 'b':[4]}

I've tried various combinations of zip, dict, and itertools.groupby and I can't get my head round how to do this.

AncientSwordRage
  • 7,086
  • 19
  • 90
  • 173

0 Answers0