(no subject)
Thu Mar 31 10:15:02 EST 2005
- Previous message (by thread): (no subject)
- Next message (by thread): (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
#! rnews 1066 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George <harry.g.george at boeing.com> Subject: Re: hex string into binary format? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <xqxsm2b981w.fsf at cola2.ca.boeing.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 28 Sender: hgg9140 at cola2.ca.boeing.com Organization: The Boeing Company References: <mailman.1136.1112277359.1799.python-list at python.org> Mime-Version: 1.0 Date: Thu, 31 Mar 2005 14:58:03 GMT Xref: news.xs4all.nl comp.lang.python:370100 "Tertius Cronje" <Tertius.Cronje at postoffice.co.za> writes: > Hi, > > How do I get a hexvalued string to a format recognized for binary > calculation? > > > import binascii > s1 = '1C46BE3D9F6AA820' > s2 = '8667B5236D89CD46' > > i1 = binascii.unhexlify(s1) > i2 = binascii.unhexlify(s2) > x = i1 ^i2 > > TypeError: unsupported operand type(s) for ^: 'str' and 'str' > > Many TIA > T i1=int(s1,16) i2=int(s2,16) -- harry.g.george at boeing.com 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718
- Previous message (by thread): (no subject)
- Next message (by thread): (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list