files and reading from them

ricky mzou at bu.edu
Mon Mar 25 01:42:28 EST 2002


not sure what you mean
but check out the "shelve" module


"Avi Homes" <Moo at houston.rr.com> wrote in message
news:auzn8.71680$Vl.2635455 at typhoon.austin.rr.com...
> I am writing a dictionary to a file, like so
> f.write(str(Info))
>
> and what it is writing to the file is the following..
> {'IPrice': '3', 'IName': 'lame lame', 'IDesc': 'stuff}
>
> and if i write in two things, i get..
> {'IPrice': '3', 'IName': 'lame lame', 'IDesc': 'stuff}
> {'IPrice': '2', 'IName': 'notworking, 'IDesc': 'annoying'}
>
> What i would like to do is pull a readline or somesuch.. and have it take
in
> the whole thing, and then just let me assign that to a empty name, and
turn
> it into a new dictionary.. like say
>  file.seek(1)
> //thats how i'd go to the first place in the file correct?
> X=file.readline()
>
> and now i can say print X['IName'] ... and its turned into a dictionary..
i
> am most likely going about this *all* wrong.
>
>
>
>





More information about the Python-list mailing list