On Sun, Jan 12, 2014 at 1:35 AM, Andriy Kornatskyy <andriy.kornats...@live.com> wrote: > from uuid import getnode as get_mac > '%012x' % get_mac() >
Code golf! Put colons in that, with as little code as possible. # Way too verbose. import uuid l=list("%012x"%uuid.getnode()) l[10:10]=l[8:8]=l[6:6]=l[4:4]=l[2:2]=':' mac = ''.join(l) # Shorter but not short enough import uuid s="%012x"%uuid.getnode() mac = ':'.join(s[i*2:i*2+2] for i in range(6)) :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list