CONTEST - What is the (best) solution?

Jeremy Bowers jerf at jerf.org
Wed Feb 2 11:59:55 EST 2005


On Wed, 02 Feb 2005 02:35:03 -0800, python wrote:
> Each pair in a dictionary is separated by CRLF and in each dictionary
> numbers of pairs can be different.
> I need to read only the the first and the last dictionaries.What is a
> best solution?
> Thanks
> Lad

Who cares about the best solution? Odds are, your process is disk-bound
anyhow. 

Is this a thinly-veiled attempt to get someone to provide you *a*
solution, or do you already have one and you are seriously asking for a
better one? Because I'd say, take the easiest programming route: Parse the
first dict into a variable, then just loop until you run out of file,
storing a parsed dict in the "last" variable and just naturally letting
later ones overwrite earlier ones.

If you want something "best"-er than that (heh heh), you're going to have
to tell us how you are measuring better-ness.



More information about the Python-list mailing list