Re: Output from to_bytes

2013-06-02 Thread Ned Batchelder
On 6/2/2013 3:09 PM, Mok-Kong Shen wrote: Am 28.05.2013 17:35, schrieb Grant Edwards: On 2013-05-26, Mok-Kong Shen wrote: I don't understand why with the code: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) one gets the following output: b'\x00\x08' b'\x0

Re: Output from to_bytes

2013-06-02 Thread Mok-Kong Shen
Am 28.05.2013 17:35, schrieb Grant Edwards: On 2013-05-26, Mok-Kong Shen wrote: I don't understand why with the code: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) one gets the following output: b'\x00\x08' b'\x00\t' b'\x00\n' b'\x00\x0b' I mea

Re: Output from to_bytes

2013-05-28 Thread Grant Edwards
On 2013-05-26, Mok-Kong Shen wrote: > I don't understand why with the code: > > for k in range(8,12,1): > print(k.to_bytes(2,byteorder='big')) > > one gets the following output: > > b'\x00\x08' > b'\x00\t' > b'\x00\n' > b'\x00\x0b' > > I mean the 2nd and 3rd should be b'\

Re: Output from to_bytes

2013-05-26 Thread Terry Jan Reedy
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'0

Re: Output from to_bytes

2013-05-26 Thread Chris Angelico
On Sun, May 26, 2013 at 10:02 PM, Mok-Kong Shen wrote: > I don't understand why with the code: > >for k in range(8,12,1): > print(k.to_bytes(2,byteorder='big')) > > one gets the following output: > >b'\x00\x08' >b'\x00\t' >b'\x00\n' >b'\x00\x0b' > > I mean the 2nd and 3rd

Output from to_bytes

2013-05-26 Thread Mok-Kong Shen
I don't understand why with the code: for k in range(8,12,1): print(k.to_bytes(2,byteorder='big')) one gets the following output: b'\x00\x08' b'\x00\t' b'\x00\n' b'\x00\x0b' I mean the 2nd and 3rd should be b'\x00\x09' and b'x00\x0a'. Anyway, how could I get the output in t