【发布时间】:2021-08-23 00:43:00
【问题描述】:
Pymongo db 我只是不确定如何让它只返回值。除了解析它返回的字符串以仅获取值之外,我真的想不出。
for col_name in col_list:
col = db[col_name]
for x in col.find( {}, {'name.details.stuff': 1, '_id': 0} ):
for key, value in x.items():
story = "the cat went after those %s/"%value
print(story )
输出:
the cat went after those {'name': {'details': 'things'}}.
我希望脚本只返回内容而不是 json/bson 内容。
【问题讨论】:
标签: python-3.x mongodb pymongo