Python 内存中CSV下载文件名
我使用csv编写器在内存中创建csv,并使用django将其作为响应返回 我的代码看起来像这样Python 内存中CSV下载文件名,python,django,Python,Django,我使用csv编写器在内存中创建csv,并使用django将其作为响应返回 我的代码看起来像这样 response = HttpResponse (content_type='text/csv') writer = csv.writer(response) writer.writerow(['rizwan','mumtaz']) ...... return response 代码运行良好,但每次我收到'download.csv'我如何将名称'download.csv'更改为somethigels
response = HttpResponse (content_type='text/csv')
writer = csv.writer(response)
writer.writerow(['rizwan','mumtaz'])
......
return response
代码运行良好,但每次我收到'download.csv'
我如何将名称'download.csv'
更改为somethigelse.csv
response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'