Get name of the local machine : Host Info « Network « Python






Get name of the local machine

Get name of the local machine
import sys, socket


hostname = socket.gethostname()
print "Host name:", hostname

           
       








Related examples in the same category

1.Get name of the local machine: Try to get the fully-qualified name
2.Basic gethostbyaddr() exampleBasic gethostbyaddr() example