Write a Python program to get the name of the host on which the routine is running.

Write a Python program to get the name of the host on which the routine is running.

1
2
3
import socket
host_name = socket.gethostname()
print("Host name:", host_name)

Final output

Leave a Comment