I have two lists in Python, like these:
temp1 = [\'One\', \'Two\', \'Three\', \'Four\'] temp2 = [\'One\', \'Two\']
I need to create a third
We can calculate intersection minus union of lists:
temp1 = ['One', 'Two', 'Three', 'Four'] temp2 = ['One', 'Two', 'Five'] set(temp1+temp2)-(set(temp1)&set(temp2)) Out: set(['Four', 'Five', 'Three'])