3

我正在做一个项目,我处理一个 URL 并使用 beautifulsoup 获取一个数组(包含列和行)。现在我需要将这些数据存储在数据存储中。我找不到任何关于在数据存储中存储数组的参考。

4

1 回答 1

13

A multivalued property is represented in the datastore api as a python list. If you can organize the data in list, you can define a part of your data model as

class MyData(ndb.Model):
    array = ndb.StringProperty(repeated=True)

In the request handler, store the data like

data = MyData()
data.array = list_you_got_from_request
data.put()
于 2013-01-25T07:03:20.060 回答