getattr should do the job : http://effbot.org/zone/python-getattr.htm
On 18 juin, 01:13, Brendan <[email protected]> wrote: > This is probably fairly simple to do but I'm fairly new to GAE and am > having trouble with it. > > Say I run a query on an entity like so: > > query1=Client.all() > query1.fetch(1) > client=query1[0] > > selecting the first entry in the entity Client. > > Then I iterate through the list of fields like so: > > for column in Client.fields(): > > How can I access the data for that column in the row given by the > query1 object? This is a fairly simple thing in Java with most > databases but I'm using Python and GAE.. > > I know I can access each element individually like this: > > first_name = client.first_name > > etc > > however I need to be able to dynamically reference the name of the > field ..something like this > > col_name = "first_name" > first_name_var = client.get(col_name) > > thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
