These are the two lists, both of which have the same number of elements:
list1 = [['23', '30', 'pm'], ['01', '00', 'am'], ['1', '00', 'am'], ['1', '00', 'pm'], ['1', '', 'pm'], ['5', '', 'pm']]
list2 = [['23', '30', 'pm'], ['01', '00', 'am'], ['01', '00', 'am'], ['01', '00', 'pm'], ['01', '00', 'pm'], ['05', '00', 'pm']]
I try with this:
list1 = list(list1 - list2)
list2 = list(list2 - list1)
print(repr(list1))
print(repr(list2))
but I get this error when trying to subtract the elements that are the same in both lists
TypeError: unsupported operand type(s) for -: 'list' and 'list'
I need the lists to be like this, that is, within each of them there are only those elements that are different:
list1 = [['1', '00', 'am'], ['1', '00', 'pm'], ['1', '', 'pm'], ['5', '', 'pm']]
list2 = [['01', '00', 'am'], ['01', '00', 'pm'], ['01', '00', 'pm'], ['05', '00', 'pm']]
How could I achieve this? (if possible without using additional libraries, although if there is no other way I would have no problem using them)