def int2ip(num):
data = []
for i in range(4):
num ,extra = divmod(num, 256)
data.insert(0, str(extra))
return ".".join(data)
def ip2int(astr):
ipnum = astr.split(".")
num = 0
for i in range(4):
num += int(ipnum[i]) * 256 ** (3-i)
return num
if name == "main":
print (int2ip(3232235786))
print(ip2int("192.168.1.10"))