def get_local_ip_address(target):
    """
    Get the local ip address to access one specific target.
    """
    ip_adr = ''
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.connect((target, 8000))
        ip_adr = s.getsockname()[0]
        s.close()
    except:
        pass

    return ip_adr
def get_local_ip_address ( target ) : ip_adr = '' try : s = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) s . connect ( ( target , 8000 ) ) ip_adr = s . getsockname ( ) [ 0 ] s . close ( ) except : pass return ip_adr
Get the local ip address to access one specific target.