Suppose I have a list of tuples like
import itertools
l=range(0,6)
m=itertools.combinations(1,2)
list(m)
How do I get those pairs of tuples (i,j);(x,y)
such that (i,j)=(y,x)
? Also, is there a way to generalize this, that is, I would to have pairs of tuples (a,b,c,...);(x,y,z...)
such that (a,b,c...)=(z,y,x...)
. Is there any efficent way of doing this? Thanks beforehand.