Answers for "how to get ip address of pc using python"

1

how to get ip address of pc using python

import socket
hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)

print(local_ip)

#it's work
Posted by: Guest on March-01-2022
1

how to get the ip address of laptop with python

#firstly import socket
import socket
#it is important to get host name get it
host_name = socket.gethostname()
ip_adress = socket.gethostbyname()
print("Ip address of",hostbyname,"is",ip_adress
Posted by: Guest on June-23-2021

Code answers related to "how to get ip address of pc using python"

Python Answers by Framework

Browse Popular Code Answers by Language