0

Please clearify this concept.

I'm trying to remove the element of one list from another list but getting this error list.remove(x): x not in list

here is an example of simplicity that im trying to do. although im using a list of strings.Click here to see Screenshot

list1 = [1,2,3,4,5,6,7,8,9,10]
list2 = [1,2,3,6,8]
list1.remove(i for i in list2)
yatu
  • 86,083
  • 12
  • 84
  • 139
  • The dupe target tells you how to do it, but here's why this doesn't work: `list.remove` expects a single element, not an iterable. The element it's been given here, is the generator (expression), which does not exist in the `list1`. – L3viathan Jul 29 '20 at 09:29
  • Not a `machine-learning` question, kindly do not spam irrelevant tags (removed). – desertnaut Jul 29 '20 at 09:36

0 Answers0