2024-10-04 09:23:36 发布
网友
我想找出一个字符串中超过4个连续的重复字符。e、 g.(string is lowercased)
(string is lowercased)
bbaaaaa ---> yes (5 consecutive a's) bbaa ---> no aabbbbbccdddddee ---> yes (5 consecutive b's)
一种可能的解决方案是将a循环到z并使用character{4,},其中{}可以是a到{}之间的任何人。在
a
z
character{4,}
有没有一个班轮?在
如果是重复的,我很抱歉
import re [i for i,j in re.findall(r"((.)\2{3,})",test_str)]
这应该对你有用。在
输出:
这应该对你有用。在
输出:
^{pr2}$相关问题 更多 >
编程相关推荐