Hi,

I'm trying to port some network protocol library to Python 3.x, and it
defines many bytes literals as plain string.



How do you define bytes literals so that the library can be ported to Python
3.x using only 2to3? For example:



In python 2.x, I need:

self.buffer = '\n'



In python 3.x, I need:

self.buffer = b'\n'



Is there a way to mark string literals so that 2to3 automatically prefixes
them with 'b'? Is there a simpler trick?



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

Reply via email to