Python 3 how to convert a list of bytes objects to a list of strings?
Grant Edwards
grant.b.edwards at gmail.com
Thu Aug 27 23:41:42 EDT 2020
On 2020-08-27, Marco Sulla <Marco.Sulla.Python at 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]
More information about the Python-list
mailing list