import socket
hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)
print(local_ip)
#it's work
#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