bson.errors.InvalidDocument: key '18435-.net前端开发工程师(深圳)' must not contain '.'
python爬虫保存到mongodb时,构造的字典中的key中包含了“.”, 解决: 筛选并将其更换
title = item["title"]
# 检测 str 是否包含在 mystr中,如果是返回开始的索引值,否则返回-1
index = title.find(".")
if index != -1:
# 字符串替换
title = title.replace(".", "-")