python中使用mongo中的_id(ObjectId)

版权声明:本文为博主原创,转载请注明出处。 https://blog.csdn.net/Chihwei_Hsu/article/details/83501434

在Python中导入ObjectId

from bson.objectid import ObjectId
a = [ObjectId('5bd184790640307f2515c99e'), ObjectId('5bd184790640307f2515c99f')]
# map(lambda x: x.toString(), a)
str(a)

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Chihwei_Hsu/article/details/83501434