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
评论列表
文章目录