This sounds quite an easy thing to do but I can't find how to do it
elegantly.

I have a list of bytes class objects (i.e. a list containing sequences
of bytes, which are basically text) and I want to convert it to a list
of string objects.

One of the difficulties of finding out how to do this is that 'list of
bytes' tends to mean a bytes object with a sequence of bytes in it
which is *not* what I'm after converting. :-)

Obviously I can do:-

    bbb = [b'aaa', b'bbb', b'ccc']
    sss = []
    for i in range(0, 2):
        sss.append(str(bbb[i])

but that does seem a bit clumsy.  Is there a better way?


-- 
Chris Green
ยท
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to