gpt4 book ai didi

python - 添加到 StringListProperty

转载 作者:太空宇宙 更新时间:2023-11-03 19:28:00 24 4
gpt4 key购买 nike

我有以下内容

 class Image(db.Model):
author = db.UserProperty()
img = db.BlobProperty()
rating = db.RatingProperty()
tags = db.ListProperty()

当用户上传图像时,他将输入以逗号分隔的标签列表那么如何使用 StringListProperty 或 ListProperty 将它们存储在数据库中?

谢谢

最佳答案

我认为你只需要分割字符串。

一个例子:

tags = self.request.get('tags').split(',')
img_ref.tags.extend(tags)
img_ref.put()

关于python - 添加到 StringListProperty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7360257/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com