【发布时间】:2020-05-14 09:33:42
【问题描述】:
我正在尝试将 .bson 文件转换为 .json。我尝试使用 bson 到 json 网站,它们都返回与 python 代码相同的内容。
bson_file = open('fishes.bson', 'rb')
b = bson.loads(bson_file.read())
print(b)
返回:
{'_id': b'5ac88a55eadcdf42044615bb', 'imgurl': 'http://www.fishbase.org/images/thumbnails/jpg/tn_Prweb_u0.jpg', 'rarity': 1, 'id': 0, 'length': 3.1, 'name': 'Aapticheilichthys websteri', 'fishLength': 3.1}
bson 文件是 2.68 MB,所以我认为它不应该只有那个。 bson文件无效吗?我还能如何访问 bson 文件? 我正在使用 python 3.8.1。
【问题讨论】: