IP block split

 

How to split an IP block like this "152.139/16" into multiple single ips

You can use the third-party IPy library, support python2, 3 environment

from IPy import IP


ip = IP('152.139/16')
a = ip[0] # 第一个
z = ip[-1] # 最后一个

a -> 152.139.0.0
z -> 152.139.255.255

The return value is an iterable object, or you can specify to get an index value

Guess you like

Origin blog.csdn.net/lyw5200/article/details/109238960