how to find the ip address in current running host using python code example
Example 1: 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)
Example 2: how to get user ip in python
import socket
host_name = socket.gethostname()
IPAddress = socket.gethostbyname(host_name)
print("Your Computer Name is:" + host_name)
print("Your Computer IP Address is:" + IPAddress)