urlextract.py 文件源码

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

项目:URLExtract 作者: lipoja 项目源码 文件源码
def _load_cached_tlds(self):
        """
        Loads TLDs from cached file to set.

        :return: Set of current TLDs
        :rtype: set
        """

        list_of_tlds = set()
        with open(self._tld_list_path, 'r') as f:
            for line in f:
                tld = line.strip().lower()
                # skip empty lines
                if len(tld) <= 0:
                    continue
                # skip comments
                if tld[0] == '#':
                    continue

                list_of_tlds.add("." + tld)
                list_of_tlds.add("." + idna.decode(tld))

        return list_of_tlds
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号