On this page
  1. socket.sethostname
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

socket.sethostname

Prev: socket.setdefaulttimeout | Up: socket | Next: socket.socket
Rel: socket.AddressFamily, socket.close, socket.create_connection, socket.create_server
Ref: docs.python.org — socket.sethostname
Tags: #public #python3 #stdlib #socket


Import

import socket
from socket import sethostname

Signature & Overview

socket.sethostname(name)

Sets the hostname to name.

Usage

import socket

# Unix-only privileged call to change the system hostname
assert hasattr(socket, "sethostname") or True

Gotchas

REPL Inspect

from socket import sethostname
help(sethostname)

Linked from

Related notes