Web Analytics

Python socket.gethostname() Function

NetworkingSocket

The socket.gethostname() function returns the hostname of the machine where the Python interpreter is currently executing.

Syntax

socket.gethostname()

Return Value

A string representing the hostname.

Example

Output
Click Run to execute your code