Mega Code Archive
Categories
/
Python
/
Network
Get name of the local machine
import sys, socket hostname = socket.gethostname() # Try to get the fully-qualified name. print "Fully-qualified name:", socket.getfqdn(hostname)