Sockets

Grant Edwards grante at visi.com
Fri Apr 8 00:04:00 EDT 2005


On 2005-04-08, Dan <dan at dontspammecauseidontlikit.com> wrote:
> On Thu, 7 Apr 2005 21:52:11 -0500, jepler at unpythonic.net wrote:
>
>>Python strings always carry their length, and can have embedded NULs.
>>    s.write("\0\1\2\3")
>>should write 4 bytes to the socket 's'.
>
> I'm taking binary data from a database, so it's not really a Python
> string.  Is there an easy way to convert it?

The struct module.

-- 
Grant Edwards                   grante             Yow!  I want to read my new
                                  at               poem about pork brains and
                               visi.com            outer space...



More information about the Python-list mailing list