Convert MAC to hex howto
Johannes Graumann
johannes_graumann at web.de
Sun Oct 7 16:38:39 EDT 2012
Paul Rubin wrote:
> Johannes Graumann <johannes_graumann at 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(':'))
Thanks to you as well!
Joh
More information about the Python-list
mailing list