2012-10-08 56 views
1
class Personel(db.Model): 
    ismarried=db.StringProperty() 


class AddPersonal(webapp.RequestHandler): 
    def get(self): 
    per=Personal() 
    #i want use a function at below, instead of per.ismarried 
    per.whatisthisfunction("ismarried")="yes" 
    per.put 

我想將字符串轉換爲實體的行爲。它可以如上所述。Google App Engine將字符串轉換爲(Entity)

回答

3

什麼你要找的是setattr

setattr(per, "ismarried", "yes")