Skip to content

Instantly share code, notes, and snippets.

@mickhan
Created June 6, 2013 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickhan/5720727 to your computer and use it in GitHub Desktop.
Save mickhan/5720727 to your computer and use it in GitHub Desktop.
tornado下载文件
filename = "%s_attack_report.xls" % file_to_download
f = open(filename, "r")
self.set_header('Content-Type', 'text/csv')
self.set_header('Content-Disposition', 'attachment; filename=' + filename + '')
self.write(f.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment