ipv4转整数,整数转ipv4
ip2long = lambda x: sum([256 ** j * int(i) for j, i in enumerate(x.split('.')[::-1])])
long2ip = lambda x: '.'.join(['{:0>3d}'.format(x // (256 ** i) % 256) for i in range(3, -1, -1)])
print(ip2long('8.8.8.8') # 输出 134744072
print(long2ip(134744072)) # 输出 008.008.008.008