how to find ip address of website using python
import socket #module for gethostbyname
website = 'www.google.com'# you can put any website
ip = socket.gethostbyname(website)
print(ip)
'Output'
'142.250.182.36'#ip of google.com
how to find ip address of website using python
import socket #module for gethostbyname
website = 'www.google.com'# you can put any website
ip = socket.gethostbyname(website)
print(ip)
'Output'
'142.250.182.36'#ip of google.com
python get ip from hostname
## importing socket module
import socket
## getting the hostname by socket.gethostname() method
hostname = socket.gethostname()
## getting the IP address using socket.gethostbyname() method
ip_address = socket.gethostbyname(hostname)
## printing the hostname and ip_address
print(f"Hostname: {hostname}")
print(f"IP Address: {ip_address}")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us