0
我努力理解什麼是錯的語法如下:蟒越獄美元符號
from pymongo import MongoClient
client = MongoClient('localhost', 27017)
db = client.monitor
#cursor = db.monitoring_logs.find({"widget": "56dfed49a2988d9019000585;"})
cursor = db.monitoring_logs.find({"widget": {$in:["56dfed49a2988d9019000585;","56d58f5b1dc95f54460002f6;"]}})
print (cursor.count())
錯誤消息:
C:\Users\Nir.Regev\Anaconda3\python.exe C:/Users/Nir.Regev/PycharmProjects/anomaly/get_mongo_data.py
File "C:/Users/Nir.Regev/PycharmProjects/anomaly/get_mongo_data.py", line 6
cursor = db.monitoring_logs.find({"widget": {$in:["56dfed49a2988d9019000585;","56d58f5b1dc95f54460002f6;"]}})
^
SyntaxError: invalid syntax
Process finished with exit code 1
是美元符號($),如果是如何得到解決這個 ?
嘗試使用'「$ in」'代替。 – Rames