Baptiste Lepilleur, 01.01.2011 10:01:
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.

See my answer in the other thread you started on this topic. You need to wrap the literal in a function call that converts it to a bytes literal when running in Python 3.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to