在此处使用 aset仅获取唯一项目:
>>> lis = [['welcome','a1'],['welcome','a1'],['hello','a2'],['hello','a3']] 
>>> [list(x) + [1] for x in set(map(tuple, lis))]
>>> [['welcome', 'a1', 1], ['hello', 'a3', 1], ['hello', 'a2', 1]]
解释: 
Set 始终从可迭代或迭代器返回唯一项,但由于集合只能包含不可变项,因此您应该首先将它们转换为元组。上述代码的详细版本,唯一的区别是也将保留原始或
>>> lis = [['welcome','a1'],['welcome','a1'],['hello','a2'],['hello','a3']] 
>>> s = set()
>>> for item in lis:
...     tup = tuple(item)  #covert to tuple
...     s.add(tup)
>>> s
set([('welcome', 'a1'), ('hello', 'a3'), ('hello', 'a2')])
现在使用列表推导来获得预期的输出:
>>> [list(item) + [1] for item in s]
[['welcome', 'a1', 1], ['hello', 'a3', 1], ['hello', 'a2', 1]]
如果项目的顺序很重要(sets不要保留顺序),那么使用这个:
>>> seen = set()
>>> ans = []
>>> for item in lis:
...     tup = tuple(item)
...     if tup not in seen:
...         ans.append(item + [1])
...         seen.add(tup)
...         
>>> ans
[['welcome', 'a1', 1], ['hello', 'a2', 1], ['hello', 'a3', 1]]
我不确定在1这里使用有什么意义。