Answers for "how to get the hostname in python"

1

how to print hostname in python

# Use socket and its gethostname() functionality. 
# This will get the hostname of the computer where the Python interpreter is running:
import socket
print(socket.gethostname())
Posted by: Guest on February-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language