Entry
how to form a list containing the union of the elements of two lists?
Oct 29th, 2007 04:20
Alexander Skwar, Robby Stephenson, lili1688 c, http://www.diveintopython.org/native_data_types/lists.html
>>> lst=["this","is","the","first","list"]
>>> lst.extend(["concatenated","with","another","list"])
>>> lst
['this', 'is', 'the', 'first', 'list', 'concatenated', 'with',
'another', 'list']
Alternative:
>>> lst=["this","is","the","first","list"]
>>> lst += ["concatenated","with","another","list"]
>>> lst
['this', 'is', 'the', 'first', 'list', 'concatenated', 'with',
'another', 'list']