Django 中文导出数据 中文文件名称 变成下载.xls

环境:

python3.6 

Django1.81

xwlt1 1.83

解放办法:

引用包:

from django.utils.http import urlquote
filename = u"员工信息表"
filename = urlquote(filename)
response = HttpResponse(content_type='application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment; filename=%s'%(filename)+ time.strftime('%Y%m%d', time.localtime(time.time())) + '.xls'

资料:Django下载中文名文件:

猜你喜欢

转载自blog.csdn.net/qq_28218253/article/details/80447900