Python 3 how to convert a list of bytes objects to a list of strings?
Chris Green
cl at isbd.net
Sat Aug 29 11:20:27 EDT 2020
Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Fri, 28 Aug 2020 12:26:07 +0100, Chris Green <cl at isbd.net> declaimed the
> following:
>
>
>
> >Maybe I shouldn't but Python 2 has been managing to do so for several
> >years without any issues. I know I *could* put the exceptions in a
> >bucket somewhere and deal with them separately but I'd really rather
> >not.
> >
>
> In Python2 "string" IS BYTE-STRING. It is never UNICODE, and ignores
> any encoding.
>
> So, for Python3, the SAME processing requires NOT USING "string" (which
> is now Unicode) and ensuring that all literals are b"stuff", and using the
> methods of the bytes data type.
>
Now I'm beginning to realise that *this* may well be what I need to
do, after going round in several convoluted circles! :-)
Thank you!
--
Chris Green
ยท
More information about the Python-list
mailing list