标签:style lis log 相同 print color 语句 pytho code
找到两个列表中相同元素:
list1 = [1,2,3,4,5] list2 = [4,5,6,7,8] print ([l for l in list1 if l in list2])
输出:
[4, 5]
列表中语句 python
原文地址:http://www.cnblogs.com/shixisheng/p/7305680.html