I'm writing a chat program for a local network. I would like be able to identify computers and get the user-set computer name with Python.
Python – How to Get the System Hostname
hostnamepython
hostnamepython
I'm writing a chat program for a local network. I would like be able to identify computers and get the user-set computer name with Python.
Best Answer
Use
socket
and itsgethostname()
functionality. This will get thehostname
of the computer where the Python interpreter is running: