Tito <titogarcia_borra_esto at gmail.com> writes: > def printPropertyForEach(collection, propertyName): > for elem in collection: > print eval("elem." + propertyName) > > Is there another approach to do it? Yes, use the getattr function: for elem in collection: print getattr(elem, propertyName)