How to write temporary data to file?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Jan 9 04:32:23 EST 2007


In <mailman.2461.1168316179.32031.python-list at python.org>, Thomas Ploch
wrote:

> d = {
> 	'url1': {
> 		'emails': ['a', 'b', 'c',...],
> 		'matches': ['d', 'e', 'f',...]
> 	},
> 	'url2': {...
> }
> 
> This dictionary will get _very_ big, so I want to write it somehow to a
> file after it has grown to a certain size.
> 
> How would I achieve that?

If you want easy access to single 'url' keys then `shelve` might be an
alternative to pickling the whole thing as one big object.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list