Baptiste Lepilleur wrote:
Hi,
I'm looking for the equivalent of the built-in chr(x) function that would return a bytes type taking an integer as parameter.

The easiest way I found to do this is the function below, but there must be some simpler way to do that and I must be overlooking something fairly obvious...

>>> bytes([12])
b'\x0c'
>>> bytes([1, 2, 3])
b'\x01\x02\x03'

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

Reply via email to