new_list = [1, 2, 3]
old_list = [3, 4, 5]
judge = [False for c in new_list if c not in old_list ]
if judge:
# judge不是None,则表示new_list中有元素是不在old_list中的
一个列表的元素是否包含另一个列表元素
最新推荐文章于 2023-05-31 16:12:25 发布
new_list = [1, 2, 3]
old_list = [3, 4, 5]
judge = [False for c in new_list if c not in old_list ]
if judge:
# judge不是None,则表示new_list中有元素是不在old_list中的