Simple Pickle Question!
Derek Basch
dbasch at yahoo.com
Thu Jul 18 00:04:35 EDT 2002
More information about the Python-list mailing list
Thu Jul 18 00:04:35 EDT 2002
- Previous message (by thread): SSL support in 2.2.1/win
- Next message (by thread): Simple Pickle Question!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jeff, Thanks for the reply. Your answer was just what I was looking for. I am using a try: except: to catch the EOFError. Any other ways to handle an empty file? Thanks, Derek Basch --- Jeff Epler <jepler at unpythonic.net> wrote: > 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 __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
- Previous message (by thread): SSL support in 2.2.1/win
- Next message (by thread): Simple Pickle Question!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list