def intersect(a, b):
“”” return the intersection of two lists “””
return list(set(a) & set(b))
def union(a, b):
“”” return the union of two lists “””
return list(set(a) | set(b))
def difference(a, b):
“”” show whats in list b which isn’t in list a “””
return list(set(b).difference(set(a)))
备注:这里应该是list(set(b)-set(a))
这个代码非常方便的使用在比较两份海量url的共同元素上