I want to replace all the character in my string with 'aaaa' as many number of times as there are occurence of the character. For eg. if my string is "cat", output should be "aaa" and if its "hello" output should be "aaaaa".
As of now, I am using
result = re.sub(r'([\w.-]+)[a-zA-Z]', 'a','Cat', count=0)
Its returning :
I want it should return 'a' as many number of times the characters are repeating, i.e. aaa