def numToDottedQuad(n):
    "convert long int to dotted quad string"
    
    d = 256 * 256 * 256
    q = []
    while d > 0:
        m,n = divmod(n,d)
        q.append(str(m))
        d = d/256

    return '.'.join(q)
convert long int to dotted quad string
recipes/Python/65219_IP_address_conversion_functions/recipe-65219.py