我试图使用python" s" new" is_global方法确定,为公共网络分配了一个IP地址(https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address.is_global)。但是,这不起作用:
>>> import ipaddress
>>> ip = ipaddress.IPv4Address('192.0.2.1')
>>> ip.is_private
True
>>> ip.is_reserved
False
>>> ip.is_global
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'IPv4Address' object has no attribute 'is_global'
>>>
如上所示,像is_private这样的其他方法工作正常。我使用的是python 3.5.1。
任何见解?