[(0, 3), (0, 11), (1, 8), (1, 9), (1, 15), (3, 0), (8, 1), (8, 9), (8, 15), (9, 1), (9, 8), (9, 15), (11, 0), (15, 1), (15, 8), (15, 9)]
里面(a,b)和(b,a)是相同的,如何去除(b,a)保留(a,b)
l1 = [(0, 3), (0, 11), (1, 8), (1, 9), (1, 15), (3, 0), (8, 1), (8, 9), (8, 15), (9, 1), (9, 8), (9, 15), (11, 0), (15, 1), (15, 8), (15, 9)] new_l = [] for i in l1: if (i[1],i[0]) in new_l: pass else: new_l.append(i) print(new_l)