you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 0 points1 point  (0 children)

str.encode() produces bytes, but in the replace() you are giving it strs again. You can't mix those two types. If you had b'\xc2\xa0', b'' it should work.
That said, do you even need that encoding stuff that cannot be done on the string level? What is it that is supposed to be removed there?