我正在尝试确保在Python中一个对象是字符串类型(用于Google应用引擎)。我这样做是为了在其超过500字节时将其更改为db.Text
类型。然而,我不断收到错误提示:TypeError 'unicode' object is not callable
if type(value) in types.StringTypes and len(value) > 499:
value = db.Text(value)
setattr(entity, key, value)
我应该使用什么来测试对象的类型是否为字符串?
value
变量更改为db.Text
吗? - inspectorG4dget