How to port bytes formatting to Python 3.x ?

Baptiste Lepilleur baptiste.lepilleur at gmail.com
Sat Jan 1 06:53:52 EST 2011


2011/1/1 Stefan Behnel <stefan_ml at behnel.de>

> 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:
>> ...
>>
> 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.
>

Is there a robust implementation of the format operator % for bytes that can
substitute %s?

I've stumbled on a bug on Mysql python 3 connector due to a "buggy" attempt
to replace it (see https://bugs.launchpad.net/myconnpy/+bug/691836).

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


More information about the Python-list mailing list