只需要一句话就可以达到效果:

>>>L = [‘aaa’, ‘bbb’, ‘ccc’, ‘bbb’, ‘aaa’]

>>>L

[‘aaa’, ‘bbb’, ‘ccc’, ‘bbb’, ‘aaa’]

>>>M = list(set(L))

>>>M

[‘aaa’, ‘bbb’, ‘ccc’]

标签:, ,