标签:style blog color for python div
int_ip = lambda x: ‘.‘.join([str(x/(256**i)%256) for i in range(3,-1,-1)]) ip_int = lambda x:sum([256**j*int(i) for j,i in enumerate(x.split(‘.‘)[::-1])]) def get_ips(ip1,ip2): f=open(‘ips.txt‘,‘w‘) ip1_num = ip_int(ip1) ip2_num = ip_int(ip2) for i in range(ip1_num,ip2_num+1): f.write(str(int_ip(i))+‘\n‘) get_ips(‘192.168.0.0‘,‘192.168.255.255‘)
Python获取两个ip之间的所有ip,布布扣,bubuko.com
标签:style blog color for python div
原文地址:http://www.cnblogs.com/Xjng/p/3824666.html