python怎么判断连续的数字/字符
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{位数,} 也可以
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{位数,} 也可以