Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'string.': 0.04; '>>>>': 0.09; 'am,': 0.12; 'bitwise': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; 'string,': 0.18; 'subject:problem': 0.19; 'header:In-Reply-To:1': 0.22; 'though.': 0.23; 'aug': 0.24; 'message-id:@mail.gmail.com': 0.29; 'print': 0.29; 'operations': 0.30; 'subject:number': 0.30; 'probably': 0.33; 'to:addr:python-list': 0.33; 'fri,': 0.36; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; "it's": 0.40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=byNfFjGHocour3QLxJ6rzJ6Ymd8iIF3eKvjTB/0+G5Y=; b=Hq0TJjvtZZWPrlTlRC+8TMbKltk+3uw0oONrZ/SaDh81je4OSYbEDQfscpJjOjAMQ7 hcXQ5tZQ+ArSizwoesx10Et5bm6R3jRgivM9FDlmnnebeXnsIOCvGKTzv8gQ2u7GXMOe VUgZ13sx+9HrdI931+r4kWXKHvRqfIufdgh7A= MIME-Version: 1.0 In-Reply-To: References: <4E3AF2FA.7000207@ieee.org> Date: Fri, 5 Aug 2011 16:32:03 +0100 Subject: Re: problem with bcd and a number From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1312558326 news.xs4all.nl 23881 [2001:888:2000:d::a6]:36377 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10909 On Fri, Aug 5, 2011 at 1:40 AM, Dan Stromberg wrote: >>>> print int(hex(0x72).replace('0x', '')) > 72 Or simpler: int(hex(0x72)[2:]) Although if you have it as a string, you need to ord() the string. It's probably better to just do the bitwise operations though. ChrisA