how to get hostname from ip python code example Example: get hostname socket socket.gethostbyname(socket.gethostname())