国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

Python set() 函數(shù)

2019-03-16 11:18 更新

Python set() 函數(shù)

Python 內(nèi)置函數(shù) Python 內(nèi)置函數(shù)

描述

Python set() 函數(shù)創(chuàng)建一個無序不重復元素集,可進行關系測試,刪除重復數(shù)據(jù),還可以計算交集、差集、并集等。

語法

set 語法:

class set([iterable])

參數(shù)說明:

  • iterable:可迭代對象對象;

返回值

返回新的集合對象。

實例

以下實例展示了 set 的使用方法:

>>>x = set('school')
>>> y = set('google')
>>> x, y
(set(['c', 'h', 'l', 'o', 's']), set(['e', 'o', 'g', 'l'])) # 重復的被刪除
>>> x & y # 交集
set(['o', 'l'])>>> x | y # 并集
set(['c', 'e', 'g', 'l', 'o', 'h', 's'])
>>> x - y # 差集
set(['c', 'h', 's'])
>>>

Python 內(nèi)置函數(shù) Python 內(nèi)置函數(shù)

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號