20230327
This commit is contained in:
1 parent
a210b66fe9
commit
28caf11e53
2 files changed
+102
-4
No files matched your search
+44
-2
@@ -104,11 +104,53 @@
|
||||
"sql = \"select * from sports_person\"\n",
|
||||
"db.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2023-03-27T06:10:30.861854Z",
|
||||
"iopub.status.busy": "2023-03-27T06:10:30.861008Z",
|
||||
"iopub.status.idle": "2023-03-27T06:10:30.877436Z",
|
||||
"shell.execute_reply": "2023-03-27T06:10:30.876689Z",
|
||||
"shell.execute_reply.started": "2023-03-27T06:10:30.861813Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"100\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pymongo\n",
|
||||
"\n",
|
||||
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
||||
"mydb = myclient[\"tice\"]\n",
|
||||
"mycol = mydb[\"test\"]\n",
|
||||
"renyuan = set()\n",
|
||||
"for x in mycol.find():\n",
|
||||
" renyuan.add(x['name'])\n",
|
||||
"print(len(renyuan))\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@@ -122,7 +164,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.5"
|
||||
"version": "3.10.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in new issue
Block a user