def load_cookies(cls, file_name=COOKIE_FILE_NAME):
"""
?????????????????????????????????
:param str file_name:
:rtype: dict | None
"""
# Python 3.5??????????????
# file_path = make_dir(Path.home() / file_name)
# return {line.split("\t")[0]: line.split("\t")[1]
# for line in file_path.read_text().split("\n")}
try:
file_path = join(expanduser("~"), file_name)
with open(file_path, "r") as fd:
return {line.split("\t")[0]: line.split("\t")[1].strip() for line in fd.readlines()}
except (FileNotFoundError, EOFError):
return None
评论列表
文章目录