Tito <[EMAIL PROTECTED]> 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)
--
http://mail.python.org/mailman/listinfo/python-list
