IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
12.4 Record object


12.4 Record object

Each single record (or row) in the record array is a records.Record object. It has these methods:

field( fieldName)
setfield( fieldname, value)
Like the RecArray, a Record object has the field method to get the field value. But since a Record object is not an array, it does not take an index or slice, so one cannot assign a value to it. So a separate set method, setfield(), is necessary:
   >>> r[1].field(0)
   999
   >>> r[1].setfield(0, -1)
   >>> print r[1]
   (-1, 'xy', 1000.0)
Like the field() method in RecArray, fieldName in Record's field() and setfield() methods can be either an integer (index) or a string (field name).

Send comments to the NumArray community.