IPy模块测试demo,打印C段ip列表 #!/usr/bin/env python # -*- coding: utf-8 -*- from IPy import IP #16是B段,24是C段 ips=IP('127.0.0.0/24') for ip in ips: print(ip) 执行结果: