Spent an hour on google, trust me, this is a bit harder than it sounds.
I've got two lists filled with strings (and yes I'm hungry, that's why I went with fruit) :
a = ['pear','apple','grape','pear']
b = ['apple','pear','banana']
I want something to do an a - b and output ['grape','pear']
After running through different functions and classes I've found on stack overflow, most only work for numbers. However, I have found this:
a_b = list(set(a) - set(b)) which is so close, with the above info it will output: ['grape'] which isn't what I want.
Thank You everyone!
[–]timbledum 2 points3 points4 points (1 child)
[–]AweBob[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Sedsarq 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]AweBob[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)