Python: Removing matched items from a list

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]

Comments

Popular posts from this blog

HIK: Getting current character and current source.