[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Python 3 how to convert a list of bytes objects to a list of strings?
From: Grant Edwards <grant.b.edwards () gmail ! com>
Date: 2020-08-28 3:41:42
Message-ID: ri9udm$34o$1 () ciao ! gmane ! io
[Download RAW message or body]
On 2020-08-27, Marco Sulla <Marco.Sulla.Python@gmail.com> wrote:
> Are you sure you want `str()`?
>
>>>> str(b'aaa')
> "b'aaa'"
>
> Probably you want:
>
> map(lambda x: x.decode(), bbb)
If you're an old Scheme or Lisp programmer. :)
This is probably the more usual way to spell it:
sss = [x.decode() for x in bbb]
--
https://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic