How to create temp file in memory???

Jeremy Jones zanesdad at bellsouth.net
Wed Oct 5 11:24:25 EDT 2005


Wenhua Zhao wrote:

>I have a list of lines. I want to feed these lines into a function.
>The input of this function is a file.
>I want to creat a temp file on disk, and write the list of lines into 
>this temp file, then reopen the file and feed it to the function.
>Can I create a this temp file on memory???
>
>
>
>Jeremy Jones wrote:
>  
>
>>Wenhua Zhao wrote:
>>
>>    
>>
>>>A.T.T
>>>
>>>Thanks a lot.
>>> 
>>>
>>>      
>>>
>>If you could elaborate a bit more, it might be helpful.  I'm guessing 
>>you want something like StringIO or cStringIO.
>>
>>
>>- jmj
>>    
>>
If the function takes a file object as an argument, you should be able 
to use StringIO or cStringIO.


- jmj



More information about the Python-list mailing list