TA的每日心情 | 奋斗 2020-8-2 21:08 |
---|
签到天数: 817 天 连续签到: 1 天 [LV.10]测试总司令
|
>>> list1 = ['a', 'c', 'c', 'd', 1, 3, 5, 6, 7, 8, 9,9]
>>> list2 = ['e', 'f', 'g', 'd', 1, 3, 3, 6, 7, 7, 9, 10]
>>> list3 = list1 + list2
>>> list3
['a', 'c', 'c', 'd', 1, 3, 5, 6, 7, 8, 9, 9, 'e', 'f', 'g', 'd', 1, 3, 3, 6, 7,
7, 9, 10]
>>> result = []
>>> [result.append(item) for item in list3 if item not in result]
[None, None, None, None, None, None, None, None, None, None, None, None, None, N
one]
>>> result
['a', 'c', 'd', 1, 3, 5, 6, 7, 8, 9, 'e', 'f', 'g', 10]
>>>
|
|