Hi I have a string as below
a = 'h\\\\\\elllo'
and I want to replace all backslashes('\') in the string with asterisk('*'). I tried doing something like this
>>> import re
>>> regex = re.compile(r"\\")
>>> re.sub(regex, '*', a)
and I get
'h***elllo'
I want six backslashes to be replaced by six asterisks. Why is that not happening in this case and how do I do that ?
Thank you.