Elegant Format for a MAC Address in Python 3.2

后端 未结 8 2201
无人及你
无人及你 2020-12-19 00:46

I am looking for a more elegant solution to formatting a MAC address with colons. I am using Python 3.2. A fancy list comprehension perhaps?

s=\"\"
h=\"0023         


        
8条回答
  •  借酒劲吻你
    2020-12-19 01:12

    from netaddr import EUI, mac_unix_expanded
    print(EUI('00:01:02:03:04:05', dialect=mac_unix_expanded))
    print(EUI('1-2-3-4-5-6', dialect=mac_unix_expanded))
    

提交回复
热议问题