python3 set 交集 差集 并集-Python 技术分享 Java技术分享 Python 爬虫技术_微信公众号:zeropython—昊天博客

In [2]: v = set(['a','b','c','d','e'])

In [3]: i = set(['dd','d'])

In [4]: v.intersection(i) # 等同于 i&v 
Out[4]: {'d'}

In [5]: v.difference(i) #等同于 i-v
Out[5]: {'a', 'b', 'c', 'e'}

In [12]: i|v 
Out[12]: {'a', 'b', 'c', 'd', 'dd', 'e'}



HTTPX 基础教程-新乡seo|网站优化,网站建设_微信公众号:zeropython—昊天博客