Can anyone think of an algorithm to put all of the addresses between two others and put them in a list (using python)? For example:
try:
from ipaddress import ip_address
except ImportError:
from ipaddr import IPAddress as ip_address
def findIPs(start, end):
start = ip_address(start)
end = ip_address(end)
result = []
while start <= end:
result.append(str(start))
start += 1
return result
print(findIPs(‘111.111.111.0‘, ‘111.111.111.3‘))
原文:https://www.cnblogs.com/blackxu/p/14591841.html