Re: How to create temp file in memory???

2005-10-05 Thread jepler
Here's how:

1. open your web browser
2. visit the url http://docs.python.org
3. click the link Library Reference (keep this under your pillow)
4. scan down the list of modules until you see these two items:
4.6 StringIO -- Read and write strings as files
4.7 cStringIO -- Faster version of StringIO 
5. ?
6. profit

Jeff


pgpH8v1zzL5Ma.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to create temp file in memory???

2005-10-05 Thread Jeremy Jones
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to create temp file in memory???

2005-10-05 Thread Wenhua Zhao
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to create temp file in memory???

2005-10-05 Thread Jeremy Jones
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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to create temp file in memory???

2005-10-05 Thread Diez B. Roggisch
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???

Yes, the answer has been given to yoou already: (c?)StringIO will help you.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list