Get entity's property value in different format (GAE-Python)
In google app engine
When i try to get开发者_如何学C propery value by ReferenceProperty element It return referenced entity value in different format Like: real stored value "Name" : "demoname" when i get and print/write: u'demoname is there any function or way to get value in proper string format. code: person model has name property: o_model = model() o_model.ref = personmodel reference #db.ReferenceProperty(person) now i get model entity object: sro.write(modelobject.ref.name) output:u'namevalue wanted:namevalueIf modelobject.ref.name
is a StringProperty, then it is "returned by the datastore as a unicode value."
The u'
looks like the repr() of a unicode
object:
>>> s = u"Unicode String."
>>> print s
Unicode String.
>>> print repr(s)
u'Unicode String.'
Perhaps sro.write()
calls repr()
or you're storing the repr()
of a Unicode string in the datastore?
精彩评论