I am trying to remove the hexadecimal characters \xef\xbb\xbf from my string however I am getting the following error.
Not quite sure how to resolve this.
>>> x = u'\xef\xbb\xbfHello' >>> x u'\xef\xbb\xbfHello' >>> type(x) <type 'unicode'> >>> print x Hello >>> print x.replace('\xef\xbb\xbf', '') Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) >>>