Skip to content

Instantly share code, notes, and snippets.

@limafm
Created July 19, 2018 19:27
Show Gist options
  • Select an option

  • Save limafm/1955d195f744be4c2aa798a8933a6359 to your computer and use it in GitHub Desktop.

Select an option

Save limafm/1955d195f744be4c2aa798a8933a6359 to your computer and use it in GitHub Desktop.
Remove all the elements that occur in one list from another
l1 = [1,2,6,8]
l2 = [2,3,5,8]
l3 = [x for x in l1 if x not in l2] # l3 will contain [1, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment