efficient list merging

Mark McEahern marklists at mceahern.com
Wed Sep 4 10:15:13 EDT 2002


> Here's an example:
> 
> lol1 = [['a'], ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i', 'j']]
> lol2 = [['d', 'e', 'f'], ['k', 'l', 'm'], ['d'], ['f', 'g'], ['a']]
> 
> I want a function which returns
> 
> mergelol = [['a'], ['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i',
> 'j'], ['k', 'l', 'm'], ['d']]

why isn't ['f', 'g'] in mergelol?

// m
-





More information about the Python-list mailing list