I'm trying to delete some hex (such as \xc3
) from strings of text.
I plan to use regular expressions to help get rid of those.
Here is my code:
import re
tweet = 'b"[/Very seldom~ will someone enter your life] to question\xc3\xa2\xe2\x82\xac\xc2\xa6"'
tweet1 = re.sub(r'\\x[a-f0-9]{2}', '', tweet)
print(tweet1)
However, instead of deleting the output I actually get the encoded version of hex. Here is my output:
b"[/Very seldom~ will someone enter your life] to questionââ¬Â¦ "
Does somebody know how I can get rid of those hex strings?... Thanks in advance.