I'm using xlwt
in python to create a Excel spreadsheet. You could interchange this for almost anything else that generates a file; it's what I want to do with the file that's important.
from xlwt import *
w = Workbook()
#... do something
w.save('filename.xls')
I want to I have two use cases for the file: I stream it out to the user's browser or I attach it to an email. In both cases the file only needs to exist the duration of the web request that generates it.
What I'm getting at, the reason for starting this thread is saving to a real file on the filesystem has its own hurdles (stopping overwriting, cleaning up the file once done). Is there somewhere I could "save" it where it lives only in memory and only for the duration of the request?
Keeping or Deleting Temp Files: What You Should Know Temp files aren't useless files; they contain data that can improve the performance of programs. If you customize the settings of a program, for instance, these changes may be saved in a temp file.
Temp files often have the extension . TMP and are stored in the C:\Users\AppData\Local\Temp folder. If you're working on a document, your word-processing app may create a temporary file to track your progress. If the app crashes, you'll be able to recover your data from the temp file.
On your keyboard, press the Windows + R keys at the same time. In the Open field, type %temp%, then press ENTER. The temp folder will open. You can also access it on your Windows 10 PC via the shortcut button below, then choose Temporary files.
Yes. Temporary files are meant to store information temporarily and don't rely on the information stored in the file. However, deleting a temporary file that is in use may cause errors with the program. To help prevent problems, many programs lock the file while in use to prevent it from being deleted.
cStringIO
(or mmap
if it should be mutable)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With