- 用法:- class ipaddress.IPv6Address(address)
- 构造一个 IPv6 地址。如果 - address不是有效的 IPv6 地址,则会引发- AddressValueError。- 以下构成有效的 IPv6 地址: - 由八组四个十六进制数字组成的字符串,每组代表 16 位。这些组由冒号分隔。这说明了一个 - exploded(速记)记法。字符串也可以- compressed(速记符号)通过各种方式。看RFC 4291详情。例如,- "0000:0000:0000:0000:0000:0abc:0007:0def"可以压缩成- "::abc:7:def".- 可选地,字符串也可以有一个范围区域 ID,用后缀表示 - %scope_id.如果存在,范围 ID 必须是非空的,并且不能包含- %.看RFC 4007详情。例如,- fe80::1234%1可能会识别地址- fe80::1234在节点的第一个链接上。
- 适合 128 位的整数。 
- 一个整数打包到长度为 16 的 - bytes对象中,big-endian。
 - >>> ipaddress.IPv6Address('2001:db8::1000') IPv6Address('2001:db8::1000') >>> ipaddress.IPv6Address('ff02::5678%1') IPv6Address('ff02::5678%1')- 地址表示的缩写形式,省略了组中的前导零,并且完全由零组成的最长组序列折叠为一个空组。 - 这也是 - str(addr)针对 IPv6 地址返回的值。- 地址表示的长格式,包括所有前导零和完全由零组成的组。 - 以下属性和方法见 - IPv4Address类的对应文档:
相关用法
- Python ipaddress.IPv4Address.reverse_pointer用法及代码示例
- Python ipaddress.IPv4Address.__format__用法及代码示例
- Python ipaddress.IPv4Network.supernet用法及代码示例
- Python ipaddress.IPv4Network.supernet_of用法及代码示例
- Python ipaddress.IPv4Network.address_exclude用法及代码示例
- Python ipaddress.IPv4Interface.ip用法及代码示例
- Python ipaddress.IPv4Network.subnets用法及代码示例
- Python ipaddress.IPv4Interface.with_prefixlen用法及代码示例
- Python ipaddress.IPv4Interface.with_netmask用法及代码示例
- Python ipaddress.IPv4Interface.with_hostmask用法及代码示例
- Python ipaddress.IPv4Network.subnet_of用法及代码示例
- Python ipaddress.IPv4Address用法及代码示例
- Python ipaddress.IPv4Network.compare_networks用法及代码示例
- Python ipaddress.IPv4Network.hosts用法及代码示例
- Python ipaddress.IPv4Interface.network用法及代码示例
- Python ipaddress.collapse_addresses用法及代码示例
- Python ipaddress.summarize_address_range用法及代码示例
- Python ipaddress.v4_int_to_packed用法及代码示例
- Python ipaddress.ip_address用法及代码示例
- Python numpy ipmt用法及代码示例
注:本文由纯净天空筛选整理自python.org大神的英文原创作品 ipaddress.IPv6Address。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
