I have the below sentence, where I want to remove the "\" from the word "don'\t". in order to be able to replace don't with do not.
a= "To say, "don\'t hate foot" is as dumb as saying "don\'t"
my_dict ={"don't":'do not'}
print(a.replace(r'\\', ""))
out: To say, "don\\\'t hate foot" is as dumb as saying "don\\\'t
print(re.sub(r'\\', "",a))
out: To say, "don\'t hate foot" is as dumb as saying "don\'t
but I would like:
To say, "don't hate foot" is as dumb as saying "don't
in order to apply
' '.join([my_dict.get(word, word) for word in x.split()]))
I am cleaning a lot of sentences on one go so I would like something stable that will not affect other syntax