my_list = [1, 2, 3]
list_find = [1, 2]
# 请用python判断list_find内的元素是否都在my_list中
# 方法1
result = all(elem in my_list for elem in list_find)
# 方法2
result = set(list_find).issubset(
set(my_list)
)
my_list = [1, 2, 3]
list_find = [1, 2]
# 请用python判断list_find内的元素是否都在my_list中
# 方法1
result = all(elem in my_list for elem in list_find)
# 方法2
result = set(list_find).issubset(
set(my_list)
)
暂无评论
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2023-12-12
2024-03-28
2024-03-13
2024-03-11
2024-03-02
2024-02-27
2024-02-22
2024-02-22
2024-02-20
2024-02-19
2024-02-19
2024-02-19
2024-02-19
2024-01-22
2024-01-21
2024-01-15
2024-01-12
2023-12-29
2023-12-29
2023-12-25