import itertools
>>> l = [(k, len(list(g))) for k, g in itertools.groupby('0000000000000')]
>>> len(l)
1
>>> l = [(k, len(list(g))) for k, g in itertools.groupby('0000000000001')]
>>> len(l)
2

(d)1{位数,} 也可以

标签: none

添加新评论