string - Parsing a MAC address with python -
how can convert hex value "0000.0012.13a4" "00:00:00:12:13:a4"?
text = '0000.0012.13a4' text = text.replace('.', '').upper() # little pre-processing # chunk groups of 2 , re-join out = ':'.join([text[i : + 2] in range(0, len(text), 2)]) print(out)
00:00:00:12:13:a4
Comments
Post a Comment