I am trying to group this list together
Example input
M1 = [['a', 14], ['a',7], ['a',16],['b',3],['b',15],['c',22],['c',1],['c',5]]
Output
[['a',14,7,16],['b',3,15],['c',22,1,5]]
Meaning group all the 'a' value together same goes for 'b', 'c' and so on