#!/usr/bin/env python
#-*-conding:utf8-*-
def emac(argv):
emac = []
for i in argv.split('.'):
try:
if int(i) <= 255:
emac.append(hex(int(i))[2:])
else :
print "Please input the vorrect address! "
except TypeError, e:
pass
emac="00:1c:%s:%s:%s:%s" %tuple(emac)
return emac
def imac(argv):
imac = []
for i in argv.split('.'):
try:
if int(i) <= 255:
imac.append(hex(int(i))[2:])
else :
print "Please input the vorrect address! "
except TypeError, e:
pass
imac="00:1c:%s:%s:%s:%s" %tuple(imac)
return imac
if __name__ == "__main__":
print '192.168.10.223::%s' %(emac('192.168.10.233'))
print '192.168.10.227::%s' %(imac('192.168.10.227'))