题解 | 整数与IP地址间的转换
def ip2ipx(ip):
x0, x1, x2, x3 = map(int,ip.split('.'))
return x0 * 256 * 256 * 256 + x1 * 256 * 256 + x2 * 256 + x3
def ipx2ip(ipx):
ip = ''
ipx = int(ipx)
for i in range(4):
ip = str(ipx % 256) + ip
ipx = int(ipx / 256)
if ipx > 0:
ip = '.' + ip
return ip
print(ip2ipx(input('')))
print(ipx2ip(input('')))

