有什么方法可以不使用暴力或类似的东西来做下面的事情吗?
str = "abbcccddddefefef"
N = 3
repeated_term = func(str,N)
print(repeated_term )
> ['c','ef']
N = 2
term = func(str,N)
print(term)
> ['b', 'dd', 'fe'] # Thanks to @blhsing for the correction!
以此类推。
https://stackoverflow.com/questions/53711428
复制相似问题