how to get host name in socket.gethostbyname in python code example Example: get hostname socket socket.gethostbyname(socket.gethostname())