On Mon, 27 May 2013 16:45:05 +0200, Mok-Kong Shen wrote:

> From an int one can use to_bytes to get its individual bytes, but how
> can one reconstruct the int from the sequence of bytes?

Here's one way:

py> n = 11999102937234
py> m = 0
py> for b in n.to_bytes(6, 'big'):
...     m = 256*m + b
...
py> m == n
True


-- 
Steven

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

Reply via email to