import re a='abbbbcccc' b=re.sub('c+','c',a)#把a中重复的c无论多少个都显示一个 print(b) c=re.sub('b+','b',b)
#把b中重复的c无论多少个都显示一个
print(c)