Python 瓶子和蟒蛇。下载时更改静态\u文件的格式
下午好。我正在尝试下载一个带有瓶子的文件。但它总是以.html格式下载。如何将其更改为.txt?非常感谢你。我的代码如下: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)) @
@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')