ipaddress.py 文件源码

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

项目:aws-cfn-plex 作者: lordmuffin 项目源码 文件源码
def _is_hostmask(self, ip_str):
        """Test if the IP string is a hostmask (rather than a netmask).

        Args:
            ip_str: A string, the potential hostmask.

        Returns:
            A boolean, True if the IP string is a hostmask.

        """
        bits = ip_str.split('.')
        try:
            parts = [x for x in map(int, bits) if x in self._valid_mask_octets]
        except ValueError:
            return False
        if len(parts) != len(bits):
            return False
        if parts[0] < parts[-1]:
            return True
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号