首页 > 解决方案 > 注释返回文件的函数的正确方法是什么?

问题描述

我正在注释一个返回 html 文件的函数。输出的正确类型是什么?现在我正在使用“对象”,但可能它太宽泛了。

@app.route('/')
def homepage() -> object:
"""
This function loads the homepage.

:return: the homepage index.html
"""
return send_from_directory(
    os.path.join(app.root_path, 'templates'),
    "index.html"
)

有什么建议么?谢谢!

标签: python-3.xtypesannotations

解决方案


推荐阅读