Suppose I have this:
My---sun--is------very-big---.
I want to replace all multiple hyphens with just one hyphen.
import re astr='My---sun--is------very-big---.' print(re.sub('-+','-',astr)) # My-sun-is-very-big-.
1.4m articles
1.4m replys
5 comments
57.0k users