Python: Removing matched items from a list
- Get link
- X
- Other Apps
list1= [12, 50, -20, -120, 14.5, 3, 6, -120]; list2= [3, -200, 50, -120];
list3A= filter(lambda x: x not in list2, list1); #[12, -20, 14.5, 6]
list3B= list(set(list1)-set(list2)); #[14.5, -20, 12, 6]
- Get link
- X
- Other Apps
Comments
Post a Comment