> I have a nested list which looks something like this: > > x = [['104', '4501919'], ['104', '237681091'], ['104', '7669477'], > ['100528064', '315259111']] You could try something like this... if you know the identical keys will always be adjacent there might be another way too. y = {} for k, v in x: y.setdefault(k, []).append(v) Tim