首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
列表中语句 python
列表中语句 python
mac
2022-06-30
85
找到两个列表中相同元素:
list1 = [1,2,3,4,5
] list2
= [4,5,6,7,8
]
print
([l
for
l
in
list1
if
l
in
list2])
输出:
[4, 5]
转载于:https://www.cnblogs.com/shixisheng/p/7305680.html
转载请注明原文地址: https://mac.8miu.com/read-16329.html
最新回复
(
0
)