Basic getaddrinfo() basic example : IP Address « Network « Python Tutorial






import sys, socket

result = socket.getaddrinfo(sys.argv[1], None)
print result[0][4]








21.8.IP Address
21.8.1.Basic gethostbyaddr() example
21.8.2.Basic getaddrinfo() basic example
21.8.3.Basic getaddrinfo() list example
21.8.4.Perform a reverse lookup on the IP address given on the command line
21.8.5.getaddrinfo() display