Python is determined whether the network segment ip

Import IPy

 >>>'192.168.1.100' in IPy.IP('192.168.1.0/24')
 is   True
 >>>'192.168.1.0/24' in IPy.IP('192.168.0.0/16')
 is   True
 >>>'192.168.1.0/24' in IPy.IP('192.168.0.0-192.168.8.255')
 is   True

Reference links:

https://blog.csdn.net/qq_41663245/article/details/79132014

Guess you like

Origin www.cnblogs.com/wangjq19920210/p/12073494.html