[Tutor] Converting bytes to a string

Phil phillor9 at gmail.com
Mon Apr 19 00:48:03 EDT 2021


On 19/4/21 10:47 am, Cameron Simpson wrote:
>
> There shouldn't be an extraneous character (unless there's something in
> the string you've not shown: repr will help there).

Thanks again Cameron,

I'd made a slight error, the mysterious character is on the end of the 
byte and doesn't appear once the byte is converted to a string. I've had 
a play with repr() and it's similar to, but not the same as, type() 
which I've used often.

The removesuffix() function is included in Python 3.9 and is available 
from dead snake, if anyone wants to know.

-- 

Regards,
Phil



More information about the Tutor mailing list