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

ipaddress.ip_interface

Prev: ipaddress.ip_address | Up: ipaddress | Next: ipaddress.ip_network
Rel: ipaddress.AddressValueError, ipaddress.collapse_addresses, ipaddress.get_mixed_type_key, ipaddress.ip_address
Ref: docs.python.org — ipaddress.ip_interface
Tags: #public #python3 #stdlib #ipaddress


Import

import ipaddress
from ipaddress import ip_interface

Signature & Overview

ipaddress.ip_interface(address)

Take an IP string/int and return an object of the correct type.

Usage

import ipaddress

iface = ipaddress.ip_interface("10.0.0.5/8")
assert iface.version == 4 and str(iface.network) == "10.0.0.0/8"

Gotchas

REPL Inspect

from ipaddress import ip_interface
help(ip_interface)

Linked from

Related notes