Convert IPv6 address to binary representation on 2.x/Windows

"Martin v. Löwis" martin at v.loewis.de
Wed Mar 4 16:13:10 EST 2009


> Neither of these values looks like 0x0000000000000001. Am I missing
> something or is the documentation just wrong? If so, how am I supposed
> to get a binary representation of an IPv6 address in the absence of
> socket.inet_pton? Should I write my I own version?

I do wonder why you need a binary representation of an IPv6 address...

Yes, writing your own routine is certainly an option. Alternatively,
you can try one of the IP address manipulation libraries, such as
ipaddr, or netaddr. Disclaimer: I haven't checked whether these support
the requested functionality; please report back when you know.

Regards,
Martin



More information about the Python-list mailing list