Output from to_bytes

Terry Jan Reedy tjreedy at udel.edu
Sun May 26 16:45:50 EDT 2013


On 5/26/2013 8:02 AM, Mok-Kong Shen wrote:
>     for k in range(8,12,1):
>       print(k.to_bytes(2,byteorder='big'))

http://bugs.python.org/issue9951
http://bugs.python.org/issue3532

import binascii as ba
for k in range(8,12,1):
     print(ba.hexlify(k.to_bytes(2,byteorder='big')))
 >>>
b'0008'
b'0009'
b'000a'
b'000b'





More information about the Python-list mailing list