Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'bytes,': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; '10:45': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'wrote:': 0.18; 'advance.': 0.19; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'url:python': 0.33; 'subject:from': 0.34; 'but': 0.35; 'sequence': 0.36; 'next': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'how': 0.40; 'url:3': 0.61; 'subject:get': 0.81 Date: Mon, 27 May 2013 11:30:18 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Mok-Kong Shen Subject: Re: How to get an integer from a sequence of bytes References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369668622 news.xs4all.nl 16001 [2001:888:2000:d::a6]:35549 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46204 On 5/27/2013 10:45 AM, 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? > The next thing in the docs after int.to_bytes is int.from_bytes: http://docs.python.org/3.3/library/stdtypes.html#int.from_bytes --Ned. > Thanks in advance. > > M. K. Shen