Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.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 瓶子和蟒蛇。下载时更改静态\u文件的格式_Python_Html_Bottle - Fatal编程技术网

Python 瓶子和蟒蛇。下载时更改静态\u文件的格式

Python 瓶子和蟒蛇。下载时更改静态\u文件的格式,python,html,bottle,Python,Html,Bottle,下午好。我正在尝试下载一个带有瓶子的文件。但它总是以.html格式下载。如何将其更改为.txt?非常感谢你。我的代码如下: @get('/api/v1/descargarHist/<id>') def descargar (id): directorio, fichero = Repo.recuperar_historial(id) return static_file(fichero, root=directorio,download='{}.txt'.format(id)) @

下午好。我正在尝试下载一个带有瓶子的文件。但它总是以.html格式下载。如何将其更改为.txt?非常感谢你。我的代码如下:

@get('/api/v1/descargarHist/<id>')
def descargar (id):
directorio, fichero = Repo.recuperar_historial(id)
return static_file(fichero, root=directorio,download='{}.txt'.format(id))
@get('/api/v1/descargarHist/'))
def描述(id):
董事会,FICHRO=报告回收人历史(id)
返回静态_文件(fichero,root=directorio,download='{}.txt'.格式(id))
不管我怎么努力,我都无法改变它。它总是以.html格式下载。有什么方法可以做到这一点吗?

静态\u文件

return static_file(fichero, root=directorio, download='{}.txt'.format(id), mimetype='text/plain')