I have 3 lists
X1 = ['A','B','C','D']
X2 = ['A','1','2','3']
X3 = ['1','W','X','Y','Z']
I run through iterations to create all combinations of the lists
ALL = [X1,X2,X3]
a = list(itertools.product(*ALL))
Output:
[('A', 'A', '1'), ('A', 'A', 'W'), ('A', 'A', 'X'), ('A', 'A', 'Y'), ('A', 'A', 'Z'), ('A', '1', '1'), ('A', '1', 'W'), ('A', '1', 'X'), ('A', '1', 'Y').......
Apart from looping all the elements inside the list, can I have another method to erase all the duplicate elements inside the list? What I want should be only
('A', '1', 'W'), ('A', '1', 'X'), ('A', '1', 'Y')....... and so on
**New Problems raised **
What if the 3 lists changed to
X1 = ['A_1','B','C','D']
X2 = ['A_2','1_1','2','3']
X3 = ['1_1','W','X','Y','Z']
Because A_1, A_2
belongs to the same group and I still want to regard them as duplicate elements. So what should I do to remove all these duplicate elements like the above example?