inet.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:hostapd-mana 作者: adde88 项目源码 文件源码
def af_for_address(text):
    """Determine the address family of a textual-form network address.

    @param text: the textual address
    @type text: string
    @raises ValueError: the address family cannot be determined from the input.
    @rtype: int
    """
    try:
        dns.ipv4.inet_aton(text)
        return AF_INET
    except:
        try:
            dns.ipv6.inet_aton(text)
            return AF_INET6
        except:
            raise ValueError
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号