av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)Python教程:Pythonisdisjoint()

python 中的isdisjoint()函數(shù)有助于檢查給定的兩個集合是否不相交。如果集合不相交,則返回真,否則返回假。不相交意味著這兩個集合沒有共同的元素。

創(chuàng)新互聯(lián)建站長期為超過千家客戶提供的網站建設服務,團隊從業(yè)經驗10年,關注不同地域、不同群體,并針對不同對象提供差異化的產品和服務;打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網生態(tài)環(huán)境。為瀘溪企業(yè)提供專業(yè)的成都網站建設、成都做網站,瀘溪網站改版等技術服務。擁有十載豐富建站經驗和眾多成功案例,為您定制開發(fā)。

 **set_a.isdisjoint(set_b)** #where parameter may be list, tuple, dictionary, and string 

isdisjoint()參數(shù):

isdisjoint()函數(shù)接受一個參數(shù)。這個方法會自動將給定的可迭代參數(shù)轉換成一個集合,以檢查它是否不相交。

參數(shù) 描述 必需/可選
設置 要在其中搜索相等項目的集合 需要

isdisjoint()返回值

此方法返回一個布爾值 true 或 false。我們也可以說,如果兩個集合的交集是一個空集,它將是一個不相交的集合。

| 投入 | 返回值 | | 如果集合不相交 | 真實的 | | 如果集合不是不相交的 | 錯誤的 |

Python 中isdisjoint()方法的示例

示例isdisjoint()在 Python 中是如何工作的?

 A = {'a', 'b', 'c', 'd'}
B = {'e', 'f', 'g'}
C = {'b', 'h', 'i'}

print(' A and B disjoint?', A.isdisjoint(B))
print(' A and C disjoint?', A.isdisjoint(C)) 

輸出:

 A and B disjoint? True
 A and C disjoint? False 

示例 2:使用其他 iterables 作為參數(shù)使用isdisjoint()

 A = {1, 2, 3, 4}
B = [5, 3, 6]
C = '3mn7'
D ={1 : 'a', 2 : 'b'}
E ={'a' : 1, 'b' : 2}

print('A and B disjoint?', A.isdisjoint(B))
print('A and C disjoint?', A.isdisjoint(C))
print('A and D disjoint?', A.isdisjoint(D))
print('A and E disjoint?', A.isdisjoint(E)) 

輸出:

 A and B disjoint? False
A and C disjoint? False
A and D disjoint? False
A and E disjoint? True

文章名稱:創(chuàng)新互聯(lián)Python教程:Pythonisdisjoint()
文章地址:http://uogjgqi.cn/article/cdgedgs.html
掃二維碼與項目經理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網交流