How to port bytes formatting to Python 3.x ?

Baptiste Lepilleur baptiste.lepilleur at gmail.com
Sat Jan 1 04:01:20 EST 2011


Hi,
I'm trying to port a small library to Python 3.x, and I'm wondering what is
the best way to port statements such as the one belows that are  frequently
found in network protocol implementation:

        headerparts = ("%s:%s\n" % (key, value) for key, value in
headers.iteritems())
        framebytes = "%s\n%s\n%s\x00" % (command, "".join(headerparts),
body)

Where all manipulated string are actually bytes, though value in headers
dict may be any objects.

Baptiste.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110101/82ce98bd/attachment.html>


More information about the Python-list mailing list