Thank you.  This works well.  I am still trying to figure out the pros and
cons of using an array, dictionary or list.

On 10/22/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> Bryan Fodness wrote:
> > Here is the actual snippet of code
> >
> >
> > calc_depth =    8.1         # which is actually d
> > unblockedFS =   13.4     # which is the indexed fs
> >
> > for line in file('21Ex6MV_tmr.dat'):
> >     d, fs1, fs2, fs3, fs4, fs5, fs6, fs7, fs8, fs9, fs10, fs11, fs12,
> > fs13, fs14, fs15, fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23, fs24,
> > fs25, fs26, fs27, fs28, fs29, fs30, fs31, fs32, fs33, fs34, fs35, fs36,
> > fs37, fs38, fs39, fs40 = line.split()
> >     if float(d) == round(calc_depth):
> >         print float('fs' + str(int(round(unblockedFS))))
>
> I think I would just keep the data in a list and index it:
>
> for line in file('21Ex6MV_tmr.dat'):
>     data = line.split()
>     d = data[0]
>     if float(d) == round(calc_depth):
>         print float(data[int(round(unblockedFS))])
>
> Kent
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to