Convert Hostname to IP Address using Python

socket library

import socket

hostname = 'google.com'
ip = socket.gethostbyname(hostname)

print(ip)

Leave a Comment

Cancel reply

Your email address will not be published.