Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 对返回文件的函数进行注释的正确方法是什么?_Python 3.x_Types_Annotations - Fatal编程技术网

Python 3.x 对返回文件的函数进行注释的正确方法是什么?

Python 3.x 对返回文件的函数进行注释的正确方法是什么?,python-3.x,types,annotations,Python 3.x,Types,Annotations,我正在注释一个返回html文件的函数。输出的正确类型是什么?现在我用的是object,但可能太宽了 @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'), "

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

@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"
)

有什么建议吗?谢谢大家!

无论从目录中发送什么,都会返回。。。执行
打印(键入(从\u目录()结束\u)
然后看看它是什么类型…是
文件
对象吗?是
str
对象吗?是
字节
对象吗?这是一个明智的建议!输出的类型是:但给出的答案仍然太宽泛了…这就是对象的类型…如果你想准确地记录这个对象的性质,那就是它的功能这是给你的