I need to merge some part of lists using python, but still couldn't get working solution. For example, I have an arr list, and I want to get
[
[1, 2, (3, 4, 5, 6, 7, 8, 9, 11, 1)],
[5, 6, (7, 8, 9, 10, 1)]
]
So, it's very similar to sql query "select * from table where smth=smth1". Below there is my code which doesn't work well, though.
arr = [[1, 2, 3, 4, 5, 6], [1, 2, 6, 7, 8, 9], [1, 2, 11, 1, 5, 9], [5, 6, 7, 8, 9, 10], [5, 6, 1, 1, 1, 1]]
result = []
for i in arr[:]:
for j in arr[:]:
if i[0] == j[0] and i[1] == j[1] and i != j:
a = i[:]
a[2:] = zip(i[2:], j[2:])
result.append(a)