How to access a field of a namedtuple using a variable for the field name? January 8, 2023 by Tarik You can use getattr getattr(my_car, field)