Python 判断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

参考链接:

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

原文地址:https://www.cnblogs.com/wangjq19920210/p/12073494.html