假设
List1 = [ 23, 45, 6, 7, 34]
List2 = [46, 23, 1, 14, 68, 56]
比较List1
和List2
,打印List1
中List2
中有double值的元素>
Output = [23,7,34]
最佳答案
试试这个:
Output = [i for i in List1 if i*2 in List2]
关于python - 检查第一个列表中的双元素是否出现在第二个列表中并打印输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54554873/