(Python)判断一个列表是否包含另一个列表所有元素

test.py
  # -*- coding: utf-8 -*-

  a = [1, 2, 3]
  b = [1, 2]
  
  d = [False for c in b if c not in a]
  if d:
      print('b not in a')
  else:
      print('b in a')

猜你喜欢

转载自blog.csdn.net/weixin_42555131/article/details/83689346