Answers for "python how to get hostname"

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
0

hostname python

import socket
print(socket.gethostname())
Posted by: Guest on September-07-2021

Python Answers by Framework

Browse Popular Code Answers by Language