[Tutor] Help? Making Variables out of the header row in a CSV file

Ralph H. Stoos Jr. rstoos at rochester.rr.com
Wed Jun 21 03:20:40 CEST 2006


Please forgive the long question, but duty calls me to get something
done with Python that I don't want somebody to do with Microsloth Excel or Miserable

The part I can't seem to get going has to do with making variables out
of the header row in the CSV file.  The way it needs to work is that the
first row may be of differing lengths (extra fields).  I want to have
the standalone Python script to make the variables and then allow the user
to sort the data based on the contents of the columns (i.e. pull out the
records that match one or more criteria).

The final product would allow me to select the input file, specify some thing
like the value of the "PPM" or "Grain" (and combinations thereof), and
write the output to a new CSV file.  The last bit would be some math on the contents of a couple of the fields.

Here is a snippet of the data so you can see what I am dealing with.




More information about the Tutor mailing list