Skip to content

Commit 43139a7

Browse files
committed
Merge branch 'editing'
2 parents 5247aee + 9b8abe0 commit 43139a7

File tree

8 files changed

+863
-20
lines changed

8 files changed

+863
-20
lines changed

001-Python 教程简介/006-Regex Tutorial for Humans.ipynb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@
11061106
"name": "python",
11071107
"nbconvert_exporter": "python",
11081108
"pygments_lexer": "ipython3",
1109-
"version": "3.7.5"
1109+
"version": "3.7.6"
11101110
},
11111111
"toc": {
11121112
"base_numbering": 1,
@@ -1117,7 +1117,12 @@
11171117
"title_cell": "Table of Contents",
11181118
"title_sidebar": "Contents",
11191119
"toc_cell": false,
1120-
"toc_position": {},
1120+
"toc_position": {
1121+
"height": "calc(100% - 180px)",
1122+
"left": "10px",
1123+
"top": "150px",
1124+
"width": "273.188px"
1125+
},
11211126
"toc_section_display": true,
11221127
"toc_window_display": true
11231128
}

002-安装 Python/001-Anaconda 安装及操作.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@ Jupyter Notebook 有助于我们编写代码、运行代码以及获取代码的
102102

103103
![Win-Anaconda-安装-1](https://pptwinpics.oss-cn-beijing.aliyuncs.com/Win-Anaconda-%E5%AE%89%E8%A3%85-1_20191216091606.jpg)
104104

105-
## 7. 在“Advanced Installation Options”中不要勾选“Add Anaconda to my PATH environment variable.”(“添加Anaconda至我的环境变量。”)。
105+
## 7. 在“Advanced Installation Options”中要勾选“Add Anaconda to my PATH environment variable.”(“添加Anaconda至我的环境变量。”)。
106106

107-
**因为如果勾选,则将会影响其他程序的使用。如果使用Anaconda,则通过打开Anaconda Navigator或者在开始菜单中的“Anaconda Prompt”(类似macOS中的“终端”)中进行使用。**
108-
109-
除非你打算使用多个版本的Anaconda或者多个版本的Python,否则便勾选“Register Anaconda as my default Python 3.6”。
107+
同时勾选“Register Anaconda as my default Python 3.6”。
110108

111109
然后点击“Install”开始安装。如果想要查看安装细节,则可以点击“Show Details”。
112110

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"在python的函数中经常能看到输入的参数前面有一个或者两个星号:例如"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": null,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"def foo(param1, *param2):\n",
17+
"def bar(param1, **param2):"
18+
]
19+
},
20+
{
21+
"cell_type": "markdown",
22+
"metadata": {},
23+
"source": [
24+
"这两种用法其实都是用来将任意个数的参数导入到python函数中。\n",
25+
"\n",
26+
"# 单星号(*):*agrs\n",
27+
"将所以参数以元组(tuple)的形式导入:\n",
28+
"例如:"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": 2,
34+
"metadata": {},
35+
"outputs": [
36+
{
37+
"name": "stdout",
38+
"output_type": "stream",
39+
"text": [
40+
"1\n",
41+
"(2, 3, 4, 5)\n"
42+
]
43+
}
44+
],
45+
"source": [
46+
"def foo(param1, *param2):\n",
47+
" print(param1)\n",
48+
" print(param2)\n",
49+
"foo(1,2,3,4,5)"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"# 双星号(**):**kwargs\n",
57+
"将参数以字典的形式导入"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": 3,
63+
"metadata": {},
64+
"outputs": [
65+
{
66+
"name": "stdout",
67+
"output_type": "stream",
68+
"text": [
69+
"1\n",
70+
"{'a': 2, 'b': 3}\n"
71+
]
72+
}
73+
],
74+
"source": [
75+
"def bar(param1, **param2):\n",
76+
" print(param1)\n",
77+
" print(param2)\n",
78+
"bar(1,a=2,b=3)"
79+
]
80+
},
81+
{
82+
"cell_type": "markdown",
83+
"metadata": {},
84+
"source": [
85+
"此外,单星号的另一个用法是解压参数列表:"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": 4,
91+
"metadata": {},
92+
"outputs": [
93+
{
94+
"name": "stdout",
95+
"output_type": "stream",
96+
"text": [
97+
"1 2\n"
98+
]
99+
}
100+
],
101+
"source": [
102+
"def foo(bar, lee):\n",
103+
" print(bar, lee)\n",
104+
"l = [1, 2]\n",
105+
"foo(*l)"
106+
]
107+
},
108+
{
109+
"cell_type": "markdown",
110+
"metadata": {},
111+
"source": [
112+
"当然这两个用法可以同时出现在一个函数中:例如"
113+
]
114+
},
115+
{
116+
"cell_type": "code",
117+
"execution_count": 5,
118+
"metadata": {},
119+
"outputs": [
120+
{
121+
"name": "stdout",
122+
"output_type": "stream",
123+
"text": [
124+
"1\n",
125+
"2\n",
126+
"(3, 4)\n",
127+
"{'e': 5, 'f': 6, 'g': 7}\n"
128+
]
129+
}
130+
],
131+
"source": [
132+
"def foo(a, b=10, *args, **kwargs):\n",
133+
" print(a)\n",
134+
" print(b)\n",
135+
" print(args)\n",
136+
" print(kwargs)\n",
137+
"foo(1, 2, 3, 4, e=5, f=6, g=7)"
138+
]
139+
},
140+
{
141+
"cell_type": "code",
142+
"execution_count": null,
143+
"metadata": {},
144+
"outputs": [],
145+
"source": []
146+
}
147+
],
148+
"metadata": {
149+
"kernelspec": {
150+
"display_name": "Python [conda env:root] *",
151+
"language": "python",
152+
"name": "conda-root-py"
153+
},
154+
"language_info": {
155+
"codemirror_mode": {
156+
"name": "ipython",
157+
"version": 3
158+
},
159+
"file_extension": ".py",
160+
"mimetype": "text/x-python",
161+
"name": "python",
162+
"nbconvert_exporter": "python",
163+
"pygments_lexer": "ipython3",
164+
"version": "3.7.6"
165+
},
166+
"toc": {
167+
"base_numbering": 1,
168+
"nav_menu": {},
169+
"number_sections": true,
170+
"sideBar": true,
171+
"skip_h1_title": false,
172+
"title_cell": "Table of Contents",
173+
"title_sidebar": "Contents",
174+
"toc_cell": false,
175+
"toc_position": {},
176+
"toc_section_display": true,
177+
"toc_window_display": false
178+
}
179+
},
180+
"nbformat": 4,
181+
"nbformat_minor": 2
182+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"https://www.youtube.com/watch?v=WgfZ80Cv4aY"
8+
]
9+
}
10+
],
11+
"metadata": {
12+
"kernelspec": {
13+
"display_name": "Python [conda env:root] *",
14+
"language": "python",
15+
"name": "conda-root-py"
16+
},
17+
"language_info": {
18+
"codemirror_mode": {
19+
"name": "ipython",
20+
"version": 3
21+
},
22+
"file_extension": ".py",
23+
"mimetype": "text/x-python",
24+
"name": "python",
25+
"nbconvert_exporter": "python",
26+
"pygments_lexer": "ipython3",
27+
"version": "3.7.6"
28+
},
29+
"toc": {
30+
"base_numbering": 1,
31+
"nav_menu": {},
32+
"number_sections": true,
33+
"sideBar": true,
34+
"skip_h1_title": false,
35+
"title_cell": "Table of Contents",
36+
"title_sidebar": "Contents",
37+
"toc_cell": false,
38+
"toc_position": {},
39+
"toc_section_display": true,
40+
"toc_window_display": false
41+
}
42+
},
43+
"nbformat": 4,
44+
"nbformat_minor": 2
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": []
9+
}
10+
],
11+
"metadata": {
12+
"kernelspec": {
13+
"display_name": "Python [conda env:root] *",
14+
"language": "python",
15+
"name": "conda-root-py"
16+
},
17+
"language_info": {
18+
"codemirror_mode": {
19+
"name": "ipython",
20+
"version": 3
21+
},
22+
"file_extension": ".py",
23+
"mimetype": "text/x-python",
24+
"name": "python",
25+
"nbconvert_exporter": "python",
26+
"pygments_lexer": "ipython3",
27+
"version": "3.7.6"
28+
},
29+
"toc": {
30+
"base_numbering": 1,
31+
"nav_menu": {},
32+
"number_sections": true,
33+
"sideBar": true,
34+
"skip_h1_title": false,
35+
"title_cell": "Table of Contents",
36+
"title_sidebar": "Contents",
37+
"toc_cell": false,
38+
"toc_position": {},
39+
"toc_section_display": true,
40+
"toc_window_display": false
41+
}
42+
},
43+
"nbformat": 4,
44+
"nbformat_minor": 2
45+
}

0 commit comments

Comments
 (0)