python 生成并下载文件-后端
txt文件
生成并下载txt文件:
@app.route(‘/download‘, methods=[‘GET‘]) def download(): content = "long text" response = make_response(content) response.headers["Content-Disposition"] = "attachment; filename=myfilename.txt" return response
txt文件
生成并下载txt文件:
@app.route(‘/download‘, methods=[‘GET‘]) def download(): content = "long text" response = make_response(content) response.headers["Content-Disposition"] = "attachment; filename=myfilename.txt" return response