Received: by 10.180.84.74 with SMTP id w10mr3124919wiy.4.1350352445676; Mon, 15 Oct 2012 18:54:05 -0700 (PDT) Path: q11ni134324876wiw.1!nntp.google.com!feeder1.cambriumusenet.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.130.MISMATCH!xlned.com!feeder1.xlned.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-l...@python.org Delivered-To: python-l...@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'integers': 0.09; 'mess': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:howto': 0.09; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:Convert': 0.16; 'subject:MAC': 0.16; 'wrote:': 0.17; 'skip:" 40': 0.20; 'paul': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'writes:': 0.29; 'convert': 0.29; "skip:' 10": 0.30; 'that.': 0.30; 'stuff': 0.30; 'mac': 0.32; "skip:' 20": 0.32; 'to:addr:python-list': 0.33; 'thanks': 0.34; 'received:org': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40 X-Injected-Via-Gmane: http://gmane.org/ To: python-l...@python.org From: Johannes Graumann Subject: Re: Convert MAC to hex howto Followup-To: gmane.comp.python.general Date: Sun, 07 Oct 2012 23:38:39 +0300 References: <7xipamcazs.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 X-Gmane-NNTP-Posting-Host: 78.101.218.97 User-Agent: KNode/4.4.11 X-BeenThere: python-l...@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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349642407 news.xs4all.nl 6845 [2001:888:2000:d::a6]:59489 X-Complaints-To: ab...@xs4all.nl Bytes: 2892 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Paul Rubin wrote: > Johannes Graumann writes: >> '00:08:9b:ce:f5:d4' >> ... >> hexcall = "\\x".join(hexcall).decode('string_escape') > > I think it's best not to mess with stuff like that. Convert to integers > then convert back: > > mac = '00:08:9b:ce:f5:d4' > hexcall = ''.join(chr(int(c,16)) for c in mac.split(':')) Thanks to you as well! Joh