How to access a field of a namedtuple using a variable for the field name? November 26, 2022 by Tarik You can use getattr getattr(my_car, field)