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 -- https://mail.python.org/mailman/listinfo/python-list