Best way to create a Dictionary from file of Key-Value pairs?

Terry Reedy tjreedy at udel.edu
Sun Feb 29 16:21:04 EST 2004


"Equis Uno" <ir4u4 at yahoo.com> wrote in message
news:692feddd.0402291222.6f2d619e at posting.google.com...
> Hi,
>
> Assume I'm given a 100k file full of key-value pairs:
>
> date,value
> 26-Feb-04,36.47
> 25-Feb-04,36.43
> 24-Feb-04,36.30
> 23-Feb-04,37.00
> 20-Feb-04,37.00
> 19-Feb-04,37.87
>
> What is the best way to copy this data into a Dictionary object?

If you really have one value for each of numerous sequential dates, you
might be better off putting values in list that is attribute of class also
with start and stop date attributes.

TJR







More information about the Python-list mailing list