Python - alternative to list.remove(x)?
- by Seafoid
Hi,
I wish to compare two lists. Generally this is not a problem as I usually use a nested for loop and append the intersection to a new list. In this case, I need to delete the intersection of A and B from A.
A = [['ab', 'cd', 'ef', '0', '567'], ['ghy5'], ['pop', 'eye']]
B = [['ab'], ['hi'], ['op'], ['ej']]
My objective is to compare A and B and delete A intersection B from A, i.e., delete A[0][0] in this case.
I tried:
def match():
for i in A:
for j in i:
for k in B:
for v in k:
if j == v:
A.remove(j)
list.remove(x) throws a ValueError.