Merging lists has made my brain hurt.

Huw Lynes huw at moving-picture.com
Wed Oct 2 12:05:39 EDT 2002


Hi All,

I have a list containing an arbitrary number of other lists. The 
internal lists contain strings. For example
lol = [
['aaa', 'bbb', 'ccc'],
['bbb', 'ccc', 'ddd'],
['ccc', 'ddd', 'eee']
]

I want to merge the three lists into a single list that only contains 
the strings present in all three lists. In the above case I want to end 
up with
['ccc']

This has me utterly stumped. Any help is appreciated.The only articles 
about merging strings that I've managed to find so far have been about 
merging strings so that you don't get repeats. Not quite what I'm 
looking for.

Thanks,
Huw




More information about the Python-list mailing list