Test, test, test

Skip Montanaro skip.montanaro at gmail.com
Fri Nov 24 12:19:05 EST 2017


Testing 1 2 3 ... (you can ignore)

def gen_dotted_quad_clues(pfx, ips):
    for ip in ips:
        yield "%s:%s/32" % (pfx, ip)
        dottedQuadList = ip.split(".")
        if len(dottedQuadList) >= 1:
            yield "%s:%s/8" % (pfx, dottedQuadList[0])
            if len(dottedQuadList) >= 2:
                yield "%s:%s.%s/16" % (pfx, dottedQuadList[0],
                                       dottedQuadList[1])
                if len(dottedQuadList) >= 3:
                    yield "%s:%s.%s.%s/24" % (pfx, dottedQuadList[0],
                                              dottedQuadList[1],
                                              dottedQuadList[2])

Skip



More information about the Python-list mailing list