python后端向前端返回下载文件的文件名中文的问题

Python3

from urllib.parse import quote
...
response['Content-Disposition'] = 'attachment; filename={0}.xlsx'.format(quote(filename))

Python2

from urllib import quote
...
# 向下兼容 Python2.6 以前的格式化字符串
response['Content-Disposition'] = 'attachment; filename=%s.xlsx' % quote(filename)
上一篇:iOS LeetCode ☞ 猜数字大小


下一篇:上传文件到AWS,浏览器打开是预览还是下载的问题