socket.gethostbyname(hostname)
- The functions translates a
hostname
to an IPv4 address - The IP address is returned as a string
- It does not support IPv6
Example of gethostbyname
>>> import socket
>>> socket.getfqdn('www.python.org')
'132.151.1.90'
References
Previous
Next