ID EN
Socket

gethostbyname

Python 3.11

Translate a host name to IPv4 address format. The IPv4 address is returned as a string, such as '100.50.200.5'. If the host name is an IPv4 address itself it is returned unchanged. See gethostbyname_ex() for a more complete interface. gethostbyname() does not support IPv6 name resolution, and getaddrinfo() should be used instead for IPv4/v6 dual stack support.

Syntax

PYTHON
socket.gethostbyname(hostname)

See Also

gethostbyname_ex() gethostbyname() getaddrinfo() auditing event Availability