a1=[1,2,3,4,5,6,7,8,9]
b1=[2,5,3]
c1=[1,4,6,8]
temp1 = [val for val in a1 if val in b1]
print temp1
temp = [val for val in a1 if val not in b1]#第一和第二比较的剩余数据
temp2 = [val for val in temp if val in c1]
print temp2
print [val for val in temp if val not in c1]#一、二比较的剩余数据和第三比较剩余的数据打印出来
一楼少了两句 我只补充 请楼主采纳一楼的
a1=[1,2,3,4,5,6,7,8,9]
b1=[2,5,3]
c1=[1,4,6,8]
temp1 = [val for val in a1 if val in b1]
print temp1
temp2 = [val for val in c1 if val in temp1]
print temp2