python中取列表相对于另一列表的唯一值
1、
>>> a = ["aaa","bbb","ccc","ddd"]
>>> b = ["ccc","ddd","eee","fff"]
>>> c = []
>>> for i in a:
if i not in b:
c.append(i)
>>> c
['aaa', 'bbb']
>>> c = list(set(c)) ## a相对于b的唯一值
>>> c
['aaa', 'bbb']
>>> d = []
>>> for i in b:
if i not in a:
d.append(i)
>>> d
['eee', 'fff']
>>> d = list(set(d))
>>> d ## b相对于a的唯一值
['eee', 'fff']