How to create a named temporary file in memory?

Posted by conradlee on Stack Overflow See other posts from Stack Overflow or by conradlee
Published on 2010-03-15T20:04:31Z Indexed on 2010/03/15 23:49 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

I would like to use Python's tempfile module to create a temporary file that I will use for communication between processes (use of pipes is awkward).

The documentation I've linked to above shows two functions that almost do what I want:

tempfile.NamedTemporaryFile # For creating named tempfiles

tempfile.SpooledTemporaryFile # For creating tempfiles in memory

but actually I want a tempfile that is both named AND in memory. Any ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about tempfile