本文實(shí)例講述了python檢查序列seq是否含有aset中
?
1 2 3 4 5 6 7 8 9 # -*- coding: utf-8 -*- def containsAny(seq, aset): """ 檢查序列seq 是否含有aset 中的項(xiàng) """ for c in seq: if c in aset: return True return False seq = [1,2,3] aset = [3,4,5] print(containsAny(seq,aset))希望本文所述對(duì)大家的Python程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
網(wǎng)友關(guān)注