pymongo
程序员文章站
2022-05-28 20:25:21
...
from fangjia import mongoClients as mongoClients
import time
import pandas
def get_collection(db, name, host="192.168.0.136", port=27017):
return mongoClients.MongoClients(db, name, host, port).collection
def findHouse(query, fields=None):
seawater105 = get_collection("fangjia", "seawater", "192.168.0.105", 27777)
for err_count in range(0, 10):
try:
lt= seawater105.count(query)
pos = list(seawater105.find(query).limit(lt))
data=pandas.DataFrame(pos)
del pos
return data
except:
#err_count = err_count + 1
time.sleep(1)
print('query error')
raise Exception("yang ben cha xun shi bai")
上一篇: python简明教程 argv
下一篇: python简明教程_02