problems using pythom tempfile module

buffi bjorn.kempen at
Sat Sep 15 23:24:18 CEST 2007

On Sep 15, 11:11 pm, "samir.... at"
<samir.... at> wrote:
> Hello everyone,
> I'm trying to test the tempfile module with the following script,
> which basically creates a temporary file, fills the file with some
> test data and prints it.
> import tempfile
> t = tempfile.TemporaryFile()
> t.write("lalalala")
> t.flush()
> print
> Unfortunately, the print statement gives me an empty string. Can
> somebody tell me what I'm doing wrong ?
> regards Samir

Do a before you do the read to "rewind" the file and then it
should work.

More information about the Python-list mailing list