[Tutor] populating an array or using a dictionary
Eric Brunson
brunson at brunson.com
Fri Oct 19 18:02:48 CEST 2007
Bryan Fodness wrote:
> The data file is larger than shown, and I was wondering if it would be
> better to populate an array or create a dictionary. Which would be
> easier?
>
A dictionary is an array with an index, if you need an index into your
data, use a dictionary, if not use an array.
>
> On 10/19/07, *Kent Johnson* <kent37 at tds.net <mailto:kent37 at tds.net>>
> wrote:
>
> Bryan Fodness wrote:
> > I have a data file that I would like to extract data from:
> >
> > FS 1 2 3 4 5
> > 1.5 1.000 1.000 1.000 1.000 1.000
> > 2.0 0.985 0.994 0.997 0.996 0.996
> > 2.5 0.967 0.976 0.981 0.981 0.982
> > 3.0 0.949 0.958 0.965 0.966 0.967
> > 3.5 0.925 0.937 0.945 0.948 0.951
> > 4.0 0.901 0.916 0.925 0.930 0.934
> > 4.5 0.882 0.896 0.906 0.912 0.917
> > 5.0 0.863 0.876 0.887 0.893 0.899
> >
> >
> > The first row is a variable d, and the first column is FS. Any
> > suggestions on the best way to do this.
>
> This looks the same as the question you asked on Wednesday...do
> you have
> some code already?
>
> It helps if you can show what you have already done and ask for help
> with changes.
>
> Kent
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list