I am trying the following
>>> import string
>>> s = 'https://google.com\n<0x03><0x03><0x03>'
>>> s.decode('utf8').encode('ascii', errors='ignore')
The expected output is:
'https://google.com'
But the hex characters and new line is not removed.