Python 3 how to convert a list of bytes objects to a list of strings?

Chris Green cl at isbd.net
Sun Aug 30 03:58:58 EDT 2020


Karsten Hilbert <Karsten.Hilbert at gmx.net> wrote:
> > However the problem appears to be that internally in Python 3 mailbox
> > class there is an assumption that it's being given 'ascii'.
> 
> Do you really _need_ the mailbox class ? From what you've
> written so far my understanding was that you receive data
> (bytes) and want to append that to a file (which happens
> to be an mbox).
> 
> Can't you "just do that" ?
> 
> IOW, read the bytes, open the file, dump the bytes, close the file ?
> 
This would have been my next approach but see the new thread I've
started about this.  The fis was to change the read from stdin so that
it produced bytes instead of a string.  The bytes are fed into the
mailbox class and it no longer tries to decode them.

-- 
Chris Green
·


More information about the Python-list mailing list