python get lan ip

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

Here is what the above code is Doing:
1. socket.gethostname(): The socket.gethostname() function returns the standard hostname of the local machine.
2. socket.gethostbyname(hostname): The socket.gethostbyname() function translates a host name to IPv4 address format.
3. print(): The print() function prints the specified message to the screen, or other standard output device.