Cleaning up conditionals
Gregory Ewing
greg.ewing at canterbury.ac.nz
Mon Jan 2 18:27:53 EST 2017
More information about the Python-list mailing list
Mon Jan 2 18:27:53 EST 2017
- Previous message (by thread): Cleaning up conditionals
- Next message (by thread): Cleaning up conditionals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Deborah Swanson wrote: > flds = len(ls[0]) > cl, ur, d1, de, lo, st, mi, ki, re, da, br, no, yn, ma, ar = > range(0,flds) You might like to consider converting the row into a namedtuple, then you could refer to the fields using attribute names instead of indexes. You could even use the header row to set up the field names in the namedtuple, so if you reorder the columns in the file, the code would automatically adapt. -- Greg
- Previous message (by thread): Cleaning up conditionals
- Next message (by thread): Cleaning up conditionals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list