I can access elements of a named tuple by name as follows(*):
from collections import namedtuple Car = namedtuple(\'Car\', \'color mileage\') my_car = Car(\'
You can use getattr
getattr
getattr(my_car, field)