[Zope-DB] Newbie question: zsql result conundrum
Dieter Maurer
dieter@handshake.de
Fri, 16 May 2003 21:39:54 +0200
Kevin Chambers wrote at 2003-5-15 20:44 -0700:
> I know there must be an easy way to get this. I need to get a field data from
> ...
> field1="firstname"
> ...
> print "%s: %s" % (field1, rec.firstname)
You ask here for "computed attribute access".
Python's way to support it is the "getattr" function:
getattr(object,expr_evaluating_to_attribute_name [,default])
More information in the Python Library Reference manual.
Dieter