def gropulistsinlist(data,columns):
ll=[[]]
#ll.append([[3,4,5,6,7,7]])
#columns=[4,5]
#data=[[3,4,5,6,7,8],[3,4,5,6,7,7],[3,4,5,6,7,9],[3,4,5,6,7,8]]
#data=[[3,4,5,6,7,7],[3,4,5,6,7,8],[3,4,5,6,7,7],[3,4,5,6,7,9],[3,4,5,6,7,8]]
for d in data:
addnew=0
addwhat=0
addwhere=0
for index,l in enumerate(ll):
if len(l)and([l[0][ii] for ii in columns]== [d[iii] for iii in columns]):
addwhere=index
addwhat=d
addnew=0
#print(ll)
#print()
break
addnew=1
addwhat=d
if(addnew):
ll.append([addwhat])
else:
ll[index].append(addwhat)
ll.pop(0)
return ll
ll will be
[
[[3, 4, 5, 6, 7, 7], [3, 4, 5, 6, 7, 7]],
[[3, 4, 5, 6, 7, 8],[3, 4, 5, 6, 7, 8]],
[[3, 4, 5, 6, 7, 9]]]
dictwith users as keys ?