Am 26.02.2011 12:26, schrieb J. Gerlach: > Am 24.02.2011 17:19, schrieb s...@uce.gov: >> >> Is there a better way to convert int to bytes then going through strings: >> >> x=5 >> str(x).encode() >> >> >> Thanks. >> > >>> bytes([8]) > b'\x08' > seems more straight forward... ... but it gives a different result. I should've tested before answering, sorry. -- http://mail.python.org/mailman/listinfo/python-list
- py3k: converting int to bytes spam
- Re: py3k: converting int to bytes Terry Reedy
- Re: py3k: converting int to bytes John Machin
- Re: py3k: converting int to bytes Terry Reedy
- Re: py3k: converting int to bytes J. Gerlach
- Re: py3k: converting int to bytes J. Gerlach