main.py 文件源码

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

项目:TheMercury 作者: nerdroychan 项目源码 文件源码
def gen():
    TEMPLATE_FILE = os.path.join(os.path.dirname(__file__), "index.jinja2")
    GENERATE_FILE = os.path.join(os.path.dirname(__file__), "gen.yaml")
    CONFIG_FILE = os.path.join(os.path.dirname(__file__), "config.yaml")
    INDEX_FILE = os.path.join(os.path.dirname(__file__), "web/index.html")

    with open(TEMPLATE_FILE) as f:
        template = jinja2.Template(f.read())

    with open(GENERATE_FILE) as f:
        gen = yaml.load(f.read())

    with open(CONFIG_FILE) as f:
        conf = yaml.load(f.read())

    with open(INDEX_FILE, "w") as f:
        f.write(template.render(title=conf["title"], update_time=gen["update_time"], entries=gen["entries"], victims=gen["fail_list"], subscriptions=sorted(conf["subscriptions"], key=lambda x: x["title"])))

    return len(gen["fail_list"])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号