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‘)