from IPy import IP
def IPs(ip):
    s1 = "/"
    s2 = "-"
    if ip.find(s1) > 0:
        ip1 = IP(ip)
        for i in ip1:
            print(i)
    elif (str(ip).find(s2)) > 0:
        for i in range(int(str(ip)[str(ip).rfind('.') + 1:str(ip).rfind('-')]),int(str(ip)[str(ip).rfind('-') + 1:]) + 1):
            print(str(ip)[:str(ip).rfind('.')+1]+str(i))


IPs('192.168.20.10-20')
IPs('192.168.10.0/24')

 

posted on 2018-06-02 11:30  ccadmin  阅读(290)  评论(0编辑  收藏  举报