173 lines
5.1 KiB
Plaintext
173 lines
5.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "488c74e2-3b75-4274-8d9a-4503f367b5ca",
|
|
"metadata": {},
|
|
"source": [
|
|
"# 高考志愿查询"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "8913f77b-bbd5-4959-b5a4-3214732f8480",
|
|
"metadata": {},
|
|
"source": [
|
|
"## 按位次模糊查询专业"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "be2371be-89f5-4879-82a9-4a1d9e6376d3",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2023-07-03T13:57:31.935033Z",
|
|
"iopub.status.busy": "2023-07-03T13:57:31.934515Z",
|
|
"iopub.status.idle": "2023-07-03T13:57:31.994646Z",
|
|
"shell.execute_reply": "2023-07-03T13:57:31.993752Z",
|
|
"shell.execute_reply.started": "2023-07-03T13:57:31.934988Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"1 西北工业大学 计算机类(卓越班) 4046\n",
|
|
"2 厦门大学 计算机类 4369\n",
|
|
"3 北京交通大学 计算机类 4571\n",
|
|
"4 四川大学 计算机类 4583\n",
|
|
"5 西南交通大学 计算机类 4851\n",
|
|
"6 山东大学 计算机类(计算机与智能方向) 5486\n",
|
|
"7 西北工业大学 计算机类 5506\n",
|
|
"8 中南大学 计算机类(计算机信息类) 5632\n",
|
|
"9 湖南大学 计算机科学与技术(拔尖实验班) 5793\n",
|
|
"10 中国农业大学 计算机类 5808\n",
|
|
"11 大连理工大学 电子信息类(电信、自动化与计算机工科实验班) 6303\n",
|
|
"12 北京科技大学 计算机类 6789\n",
|
|
"13 山东大学 计算机类(软件数媒与大数据方向) 7425\n",
|
|
"14 重庆大学 计算机类(计算机与软件) 7581\n",
|
|
"15 南京航空航天大学 计算机科学与技术 7943\n",
|
|
"16 湖南大学 计算机科学与技术 8062\n",
|
|
"17 西安电子科技大学 计算机类 8528\n",
|
|
"18 湖南大学 计算机科学与技术(智能班) 8702\n",
|
|
"19 吉林大学 计算机类 8724\n",
|
|
"20 哈尔滨工业大学(威海) 计算机类 8895\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import pymongo\n",
|
|
"import re\n",
|
|
"\n",
|
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
|
"mydb = myclient[\"gaokao\"]\n",
|
|
"mycol = mydb[\"admission_2020\"]\n",
|
|
"\n",
|
|
"m_zhuanye = '计算机'\n",
|
|
"m_rank1 = 4000\n",
|
|
"m_rank2 = 9000\n",
|
|
"\n",
|
|
"myquery = {'spe_name':re.compile(m_zhuanye),'rank_min':{\"$gte\": m_rank1,\"$lte\": m_rank2}}\n",
|
|
"i = 1\n",
|
|
"for x in mycol.find(myquery,{\"_id\": 0, }):\n",
|
|
" print(i,x['col_name'],x['spe_name'],x['rank_min'])\n",
|
|
" i += 1\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "2731820f-b81e-4d7e-8f53-a2501d9c943f",
|
|
"metadata": {},
|
|
"source": [
|
|
"## 按分数模糊查询专业"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 51,
|
|
"id": "07dbb641-d594-4c7c-92da-045a5370e6e9",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2023-06-28T02:27:08.902334Z",
|
|
"iopub.status.busy": "2023-06-28T02:27:08.901812Z",
|
|
"iopub.status.idle": "2023-06-28T02:27:08.944814Z",
|
|
"shell.execute_reply": "2023-06-28T02:27:08.943941Z",
|
|
"shell.execute_reply.started": "2023-06-28T02:27:08.902286Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"1 北京师范大学 历史学类 639\n",
|
|
"2 南开大学 历史学类 634\n",
|
|
"3 四川大学 历史学类 633\n",
|
|
"4 华东师范大学 历史学 632\n",
|
|
"5 中山大学 历史学(广州) 630\n",
|
|
"6 中国社会科学院大学 历史学 622\n",
|
|
"7 湖南大学 历史学 618\n",
|
|
"8 山东大学 历史学类 616\n",
|
|
"9 华中师范大学 历史学类 615\n",
|
|
"10 中央民族大学 历史学类 614\n",
|
|
"11 南京师范大学 历史学类 607\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import pymongo\n",
|
|
"import re\n",
|
|
"\n",
|
|
"myclient = pymongo.MongoClient('mongodb://localhost:27017/')\n",
|
|
"mydb = myclient[\"gaokao\"]\n",
|
|
"mycol = mydb[\"admission_2022\"]\n",
|
|
"\n",
|
|
"m_zhuanye = '历史'\n",
|
|
"m_fenshu = 607\n",
|
|
"\n",
|
|
"myquery = {'spe_name':re.compile(m_zhuanye),'num_min':{\"$gte\": m_fenshu}}\n",
|
|
"i = 1\n",
|
|
"for x in mycol.find(myquery,{\"_id\": 0, }):\n",
|
|
" print(i,x['col_name'],x['spe_name'],x['num_min'])\n",
|
|
" i += 1\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "1778e718-d258-4a53-bb14-f82e09211fb7",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
},
|
|
"toc-autonumbering": true,
|
|
"toc-showmarkdowntxt": true,
|
|
"toc-showtags": false
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|