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