# -*- coding: utf-8 -*-
__author__ = 'zww'
import pprint
from pymongo import MongoClient
from bson import json_util as jsonb
import json
import csv
client = MongoClient('localhost', 27017)
db = client.xxx
col = db.xxx
content = jsonb.dumps(list(col.find({"xxx": xxx})))
des_file = open('xxx','ab')
csv_writer = csv.writer(des_file)
with des_file as f:
json.dump(content,f)
MongoDB与python连接及读取信息
最新推荐文章于 2024-06-13 20:40:05 发布