How To Remove Any Unicode Repeating Letter?
In english, sometimes you have repeating letter like this : hello my hero hhhhhhhhhhh that's for h, but I want to remove all kinds of letters repeating like this 2 or more times an
Solution 1:
try this:
from itertools import groupby
defremove_dups(s):
replace_with = ' 'return''.join([x ifsum(1for i in y)<2else replace_with for x,y in groupby(s)])
Post a Comment for "How To Remove Any Unicode Repeating Letter?"