Answers for "python get pc ip address"

10

get IP address python

import socket    
hostname = socket.gethostname()    
IPAddr = socket.gethostbyname(hostname)    
print("Your Computer Name is:" + hostname)    
print("Your Computer IP Address is:" + IPAddr) 
#How to get the IP address of a client using socket
Posted by: Guest on April-02-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language