how to get local hostname py socket code example Example: get hostname socket socket.gethostbyname(socket.gethostname())