Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 355 Bytes

File metadata and controls

13 lines (9 loc) · 355 Bytes

Get IP Address From Hostname

In Python, we can get IP Address for a hostname by using gethostbyname function from socket module, which is in built in Python.

Example

>>> import socket
>>> socket.gethostbyname("www.google.com")
'172.217.166.4'

Source: Simplified Guide