区分IPv4与IPv6:
>>> import IPy >>> ip_address = '172.19.10.178' >>> print IPy.IP(ip_address).version() 4 >>> import IPy >>> ip_address = '::1' >>> print IPy.IP(ip_address).version() 6