Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30933
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Convert MAC to hex howto |
| References | <mailman.1931.1349639025.27098.python-list@python.org> |
| Date | 2012-10-07 12:56 -0700 |
| Message-ID | <7xipamcazs.fsf@ruckus.brouhaha.com> (permalink) |
| Organization | Nightsong/Fort GNOX |
Johannes Graumann <johannes_graumann@web.de> 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(':'))
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Convert MAC to hex howto Johannes Graumann <johannes_graumann@web.de> - 2012-10-07 22:44 +0300
Re: Convert MAC to hex howto Paul Rubin <no.email@nospam.invalid> - 2012-10-07 12:56 -0700
Re: Convert MAC to hex howto Johannes Graumann <johannes_graumann@web.de> - 2012-10-07 23:38 +0300
csiph-web