socket.gethostname

socket.gethostname()

  • The functions returns the hostname of the machine where the Python interpreter is currently executing

Example of gethostname

>>> import socket
>>> socket.gethostname()
myPC

References

Previous
Next

socket.getnameinfo

socket.getsockname