Am I missing something here? ipaddress vs socket

the.loeki at gmail.com the.loeki at gmail.com
Fri May 1 05:42:25 EDT 2015


Hi all,

Given the following code:

import ipaddress
import socket

ip = ipaddress.ip_address(mystring)
sock_family = ip.????
socket = socket.socket(sock_family, socket.SOCK_STREAM)

Am I crazy or is this undoable?

sock.AF_INET == 2
sock.AF_INET6 == 10
ip.version == 4 or 6





More information about the Python-list mailing list