Get name of the local machine: Try to get the fully-qualified name : Host Info « Network « Python






Get name of the local machine: Try to get the fully-qualified name

import sys, socket


hostname = socket.gethostname()
# Try to get the fully-qualified name.
print "Fully-qualified name:", socket.getfqdn(hostname)

           
       








Related examples in the same category

1.Get name of the local machineGet name of the local machine
2.Basic gethostbyaddr() exampleBasic gethostbyaddr() example