Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Chris Angelico <ros...@gmail.com> writes: > >But this is a really good job for a list comprehension: > >sss = [str(word) for word in bbb] > > Are you all sure that "str" is really what you all want? > Not absolutely, you no doubt have been following other threads related to this one. :-)
> |>>> b = b"b" > |>>> str( b ) > |"b'b'" > > Maybe try to /decode/ the bytes? > > |>>> b.decode( "ASCII" ) > |'b' > > Therein lies the problem, the incoming byte stream *isn't* ASCII, it's an E-Mail message which may, for example, have UTF-8 or other encoded characters in it. Hopefully it will have an encoding given in the header but that's only if the sender is 'well behaved', one needs to be able to handle almost anything and it must be done without 'manual' interaction. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list