[egenix-users] writing binary files

M.-A. Lemburg mal at lemburg.com
Fri Oct 31 10:02:47 CET 2003


Kelly Prendergast wrote:
> Python newbie here,
> 
> I am retrieving data from SQL Server that is stored as a 144 byte
> binary. If I understand the Phyton documentation, the data is returned a
> ptyhon string type
> What is the best way to write this string to a binary file?

The short version:

open('filename.bin', 'wb').write(stringdata)

For a longer version, I'd suggest you have a look at one of
the nice Python books out there.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Software directly from the Source  (#1, Oct 31 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the egenix-users mailing list