[Python] python检查序列seq 是否含有aset 中的项 →→→→→进入此内容的聊天室

来自 , 2019-10-04, 写在 Python, 查看 98 次.
URL http://www.code666.cn/view/35c1f9c5
  1. # -*- coding: utf-8 -*-
  2. def containsAny(seq, aset):
  3.     """ 检查序列seq 是否含有aset 中的项 """
  4.     for c in seq:
  5.         if c in aset: return True
  6.     return False
  7.  
  8. seq = [1,2,3]
  9. aset = [3,4,5]
  10. print(containsAny(seq,aset))
  11. #//python/5058

回复 "python检查序列seq 是否含有aset 中的项"

这儿你可以回复上面这条便签

captcha