(Sep-26-2020, 01:28 PM)Milfredo Wrote:'dist_yards1' : line[315], 'dist_yards2' : line[316], 'dist_yards3' : line[317], 'dist_yards4' : line[318], 'dist_yards5' : line[319], 'dist_yards6' : line[320], 'dist_yards7' : line[321], 'dist_yards8' : line[322], 'dist_yards9' : line[323], 'dist_yards10' : line[324],
One thing you might consider, for runs like this that always have the same number of data points, is to keep the dictionary element as a single list of N values. So,
h["dist_yards"] = [ line[315], line[316], .... line[324] ] # Which, if they're all adjacent in the source data, # you can even assign using a list slice: h["dist_yards"] = line[315:324]And so on for the other multi-value parameters. Then you'd just access them as,
h["dist_yards"][0]
through h["dist_yards"][9]
. (Or in any combinations, again using slices if appropriate: first_three_dist_yards = h["dist_yards"][0:2]
Correction: I screwed up my slice syntax, as usual.
# Make that h["dist_yards"] = line[315:325] # Yes, one higher than the last element # And first_three_dist_yards = h["dist_yards"][0:3]