Simple Pickle Question!
Jeff Epler
jepler at unpythonic.net
Tue Jul 16 16:43:27 EDT 2002
More information about the Python-list mailing list
Tue Jul 16 16:43:27 EDT 2002
- Previous message (by thread): Simple Pickle Question!
- Next message (by thread): Problem importing in a cgi script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You must "seek" the file to the beginning to read it again from the
beginning.
Here's an example without the use of pickle:
f = open("test_readwrite", "w+")
f.write("hi there")
# f.seek(0)
print `f.read()`
If you uncomment the 'seek' line, you'll get some text in f.read().
Otherwise, you'll get an empty string (EOF).
Pickle doesn't seem to handle premature EOF well.. (the missing key is
probably the empty string)
Jeff
- Previous message (by thread): Simple Pickle Question!
- Next message (by thread): Problem importing in a cgi script
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list