binary data

Fredrik Lundh fredrik at
Thu Aug 26 06:20:25 EDT 1999

Gerhard W. Gruber <g.gruber at> wrote:
> How do I write binary data to a file?
> I'm using open() and write and I always get the error that n is an
> integer.

1. make sure to open the file in binary mode (the 'b' flag).

2. for different ways to convert integers to binary data, see:


More information about the Python-list mailing list