saving NNTP bodies to disk

Alex Martelli aleaxit at yahoo.com
Tue Dec 26 19:00:32 EST 2000


"Daniel" <Daniel.Kinnaer at AdValvas.be> wrote in message
news:3a4925f7.51675327 at news.skynet.be...
    [snip]
> try to write a list to disk using f.write() and Python complains about
> this with following report
>
>  f.write(TheBody[i])
> TypeError: read-only character buffer, list
>
> Below is the script. Can someone please explain me what I'm doing
> wrong?  All help is greatly appreciated.  Thanks

Python is saying: I need a read-only character buffer, you give me
a list -- implying, a list has no conversion to such a buffer.

If TheBody[i] is a list of strings, you can write it to file with
    f.writelines(TheBody[i])


Alex






More information about the Python-list mailing list