commit | 909fa51f5589c7bcbdf70528bff1b9dfcc18e326 | [log] [tgz] |
---|---|---|
author | Steven Laver <lavers@google.com> | Wed Aug 07 15:49:46 2019 -0700 |
committer | Steven Laver <lavers@google.com> | Wed Aug 07 15:49:46 2019 -0700 |
tree | 28b551946793b147cc285bf8c7c05b7359d11386 | |
parent | c015c6ccd985eddeabfa5473957af55ca741f20a [diff] | |
parent | d3e8c884fa44885337abf2f45183e255016434dc [diff] |
Merge RP1A.190528.001 Change-Id: I8b0d50c6412e89923d702d24334cb9b515579cb2
Python 3.3+'s ipaddress for Python 2.6, 2.7, 3.2.
Note that as in Python 3.3+ you must use character strings and not byte strings for textual IP address representations:
>>> from __future__ import unicode_literals >>> ipaddress.ip_address('1.2.3.4') IPv4Address(u'1.2.3.4')
or
>>> ipaddress.ip_address(u'1.2.3.4') IPv4Address(u'1.2.3.4')
but not:
>>> ipaddress.ip_address(b'1.2.3.4') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "ipaddress.py", line 163, in ip_address ' a unicode object?' % address) ipaddress.AddressValueError: '1.2.3.4' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?