读取mongo数据库,把数据存到Excel中
作者:互联网
"""
author:张鑫
date:2021/11/3 15:15
"""
# 导入模块
import pandas as pd
import pymongo
# 连接数据库
client = pymongo.MongoClient('localhost', 27017)
db = client['zhaopin']
zhilian = db['zhilian']
# 读取数据
data = list(zhilian.find())
# 写入到Excel表
s = pd.DataFrame(data)
# 命名表格
s.to_excel('./北京python爬虫工程师招聘信息_智联招聘.xlsx', encoding='utf8')
print('导入成功')
标签:15,mongo,db,Excel,data,zhilian,存到,pymongo 来源: https://www.cnblogs.com/wolvies/p/15504363.html