a = [1,1,1,1,2,2,2,2,3,3,4,5,5]from itertools import groupby[len(list(group)) for key, group in groupby(a)]
输出:
[4, 4, 2, 1, 2]
欢迎分享,转载请注明来源:内存溢出
a = [1,1,1,1,2,2,2,2,3,3,4,5,5]from itertools import groupby[len(list(group)) for key, group in groupby(a)]
输出:
[4, 4, 2, 1, 2]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)