0

I want to make result to be dict:

gyms = store.find(Gym)
for g in gyms:
    print dict(g)

It's wrong with it , but how could I make the result to be dict ?

Now I get dict with a function:

class Gym(object):

    def get_dict(self):
    return dict(id   = self.id,
                name = self.name,
                addr = self.addr,
                create_time = str(self.create_time))

but I have to define get_dict() to every class,I can't bare with it.

How could I get dict convenient ?

olivetree123
  • 173
  • 3
  • 13

0 Answers0