I am looking for a Python solution for obtaining the current machine default domain name, one that will work on Linux, Mac OS X and Windows.
So far I discovered that:
- Linux has
dnsdomainnamewhich returns it
I am looking for a Python solution for obtaining the current machine default domain name, one that will work on Linux, Mac OS X and Windows.
So far I discovered that:
dnsdomainname which returns itTry:
from socket import gethostname
machine_name=gethostname()
print(machine_name)