commit | d3e8c884fa44885337abf2f45183e255016434dc | [log] [tgz] |
---|---|---|
author | Kevin Cheng <kevcheng@google.com> | Wed May 08 08:19:59 2019 -0700 |
committer | android-build-merger <android-build-merger@google.com> | Wed May 08 08:19:59 2019 -0700 |
tree | 28b551946793b147cc285bf8c7c05b7359d11386 | |
parent | c015c6ccd985eddeabfa5473957af55ca741f20a [diff] | |
parent | bcb01090b547a9a02bddcb8da219d9861ebf6012 [diff] |
Merge commit 'd91da79' into import am: f8b29e13fb am: 9318fe5741 am: bcb01090b5 Change-Id: I7044923100a851e0ca3122b6adb02f593952a1dc
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?