时间:2021-07-01 10:21:17 帮助过:3人阅读
python版本2.7,mongodb2.6.9,pymongo
首先在mongodb中创建一个数据库users,然后连接到users
from pymongo import MongoClient
mc=MongoClient("localhost",27017)
db=mc.users
db.users.save({"name":"me","age":"23"})
c=db.users.find()
for o in c:
print(o)
python如何通过pymongo连接到mongodb?
标签: