I have two lists
JavaScript
x
3
1
list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
2
list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
3
and when I loop through the list
JavaScript
1
5
1
list_difference = []
2
for item in list1:
3
if item not in list2:
4
list_difference.append(item)
5
and I managed to get the difference, but I need time as well
because it is a separate item and 'uvz'
does not mean to me anything in the list with a few thousand entries.
I tried to convert it to the dictionary, but it overwrites with the last key:value {'01:15' : 'def'}
.
Advertisement
Answer
reformat your data, then do whatever you have done before
JavaScript
1
3
1
list1=list(zip(list1[::2],list1[1::2]))
2
list2=list(zip(list2[::2],list2[1::2]))
3