Browse Source

Update Pyhon notes

pull/15/head
bushuhui 3 years ago
parent
commit
9cfdbf186c
7 changed files with 325 additions and 244 deletions
  1. +11
    -13
      0_python/0-ipython_notebook.ipynb
  2. +86
    -66
      0_python/1_Basics.ipynb
  3. +22
    -39
      0_python/2_Print_Statement.ipynb
  4. +188
    -118
      0_python/3_Data_Structure_1.ipynb
  5. +13
    -5
      0_python/4_Data_Structure_2.ipynb
  6. +4
    -2
      0_python/5_Control_Flow.ipynb
  7. +1
    -1
      0_python/README.md

+ 11
- 13
0_python/0-ipython_notebook.ipynb
File diff suppressed because it is too large
View File


+ 86
- 66
0_python/1_Basics.ipynb View File

@@ -16,37 +16,37 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['.ipynb_checkpoints',\n",
" 'Python.pdf',\n",
"['0-ipython_notebook_EN.ipynb',\n",
" '1_Basics_EN.ipynb',\n",
" '2_Print_Statement_EN.ipynb',\n",
" '3_Data_Structure_1_EN.ipynb',\n",
" '4_Data_Structure_2_EN.ipynb',\n",
" '5_Control_Flow_EN.ipynb',\n",
" '6_Function_EN.ipynb',\n",
" '3_Data_Structure_1_EN.ipynb',\n",
" '7_Class_EN.ipynb',\n",
" 'Python.pdf',\n",
" 'README_ENG.md',\n",
" 'images',\n",
" '0-ipython_notebook_EN.ipynb',\n",
" 'test.txt',\n",
" 'README_ENG.md',\n",
" '.ipynb_checkpoints',\n",
" '0-ipython_notebook.ipynb',\n",
" '1_Basics.ipynb',\n",
" '2_Print_Statement.ipynb',\n",
" '3_Data_Structure_1.ipynb',\n",
" '4_Data_Structure_2.ipynb',\n",
" '5_Control_Flow.ipynb',\n",
" '6_Function.ipynb',\n",
" '7_Class.ipynb',\n",
" 'README.md']"
" 'README.md',\n",
" '1_Basics.ipynb']"
]
},
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@@ -59,7 +59,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -134,7 +134,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {
"collapsed": true
},
@@ -147,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [
{
@@ -171,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"collapsed": true
},
@@ -182,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -228,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
@@ -237,7 +237,7 @@
"3"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
@@ -248,7 +248,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
@@ -257,7 +257,7 @@
"1"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
@@ -268,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -277,7 +277,7 @@
"2"
]
},
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -288,7 +288,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"outputs": [
{
@@ -297,7 +297,7 @@
"0.5"
]
},
"execution_count": 11,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
@@ -315,7 +315,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [
{
@@ -324,7 +324,7 @@
"0.5"
]
},
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
@@ -335,7 +335,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [
{
@@ -344,7 +344,7 @@
"0.5"
]
},
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
@@ -355,7 +355,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"outputs": [
{
@@ -364,7 +364,7 @@
"5"
]
},
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
@@ -382,7 +382,27 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"9 // 2"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
@@ -391,7 +411,7 @@
"1.0"
]
},
"execution_count": 15,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
@@ -423,7 +443,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 23,
"metadata": {
"collapsed": true
},
@@ -434,7 +454,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 24,
"metadata": {},
"outputs": [
{
@@ -443,7 +463,7 @@
"True"
]
},
"execution_count": 17,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
@@ -454,7 +474,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 25,
"metadata": {},
"outputs": [
{
@@ -463,7 +483,7 @@
"False"
]
},
"execution_count": 18,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@@ -495,7 +515,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 26,
"metadata": {
"collapsed": true
},
@@ -507,7 +527,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 27,
"metadata": {},
"outputs": [
{
@@ -526,7 +546,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 28,
"metadata": {},
"outputs": [
{
@@ -535,7 +555,7 @@
"2"
]
},
"execution_count": 22,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
@@ -557,7 +577,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 29,
"metadata": {},
"outputs": [
{
@@ -566,7 +586,7 @@
"10"
]
},
"execution_count": 23,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
@@ -616,7 +636,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 30,
"metadata": {},
"outputs": [
{
@@ -625,7 +645,7 @@
"'0xaa'"
]
},
"execution_count": 24,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
@@ -636,7 +656,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 31,
"metadata": {},
"outputs": [
{
@@ -645,7 +665,7 @@
"170"
]
},
"execution_count": 25,
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
@@ -656,7 +676,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 32,
"metadata": {},
"outputs": [
{
@@ -665,7 +685,7 @@
"'0o10'"
]
},
"execution_count": 26,
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
@@ -683,7 +703,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 34,
"metadata": {},
"outputs": [
{
@@ -711,7 +731,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 35,
"metadata": {},
"outputs": [
{
@@ -737,7 +757,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 36,
"metadata": {},
"outputs": [
{
@@ -746,7 +766,7 @@
"'b'"
]
},
"execution_count": 29,
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
@@ -757,7 +777,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 37,
"metadata": {},
"outputs": [
{
@@ -766,7 +786,7 @@
"98"
]
},
"execution_count": 30,
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
@@ -791,7 +811,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 38,
"metadata": {
"scrolled": false
},
@@ -819,7 +839,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 39,
"metadata": {},
"outputs": [
{
@@ -844,7 +864,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 40,
"metadata": {},
"outputs": [
{
@@ -853,7 +873,7 @@
"(4, 1)"
]
},
"execution_count": 34,
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
@@ -871,7 +891,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 41,
"metadata": {},
"outputs": [
{
@@ -899,7 +919,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 42,
"metadata": {},
"outputs": [
{
@@ -908,7 +928,7 @@
"int"
]
},
"execution_count": 1,
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
@@ -919,7 +939,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 43,
"metadata": {},
"outputs": [
{
@@ -928,7 +948,7 @@
"type"
]
},
"execution_count": 2,
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
@@ -946,7 +966,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 45,
"metadata": {},
"outputs": [
{
@@ -1007,7 +1027,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 48,
"metadata": {},
"outputs": [
{
@@ -1024,7 +1044,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 50,
"metadata": {},
"outputs": [
{
@@ -1033,7 +1053,7 @@
"str"
]
},
"execution_count": 40,
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}


+ 22
- 39
0_python/2_Print_Statement.ipynb View File

@@ -63,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [
{
@@ -86,7 +86,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
@@ -114,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"scrolled": true
},
@@ -145,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
@@ -176,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
@@ -209,7 +209,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -236,7 +236,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"当引用多个变量时使用圆括号。"
"**NOTE: 当引用多个变量时使用圆括号。**"
]
},
{
@@ -270,23 +270,6 @@
"下面是使用print语句的其他不同方式。"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I want to be printed here\n"
]
}
],
"source": [
"print(\"I want to be printed %s\" % 'here')"
]
},
{
"cell_type": "code",
"execution_count": 14,
@@ -330,7 +313,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {},
"outputs": [
{
@@ -354,7 +337,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 20,
"metadata": {},
"outputs": [
{
@@ -371,7 +354,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 22,
"metadata": {},
"outputs": [
{
@@ -380,7 +363,7 @@
"text": [
"\n",
"Routine:\n",
"\t- Eat\n",
"\t- Eat (\\t)\n",
"\t- Sleep\n",
"\t- Repeat\n",
"\n"
@@ -390,7 +373,7 @@
"source": [
"print(\"\"\"\n",
"Routine:\n",
"\\t- Eat\n",
"\\t- Eat (\\\\t)\n",
"\\t- Sleep\\n\\t- Repeat\n",
"\"\"\")"
]
@@ -413,7 +396,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 23,
"metadata": {},
"outputs": [
{
@@ -422,7 +405,7 @@
"'3.121312'"
]
},
"execution_count": 19,
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
@@ -440,7 +423,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 24,
"metadata": {},
"outputs": [
{
@@ -449,7 +432,7 @@
"'3.12131'"
]
},
"execution_count": 20,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
@@ -467,7 +450,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 25,
"metadata": {},
"outputs": [
{
@@ -476,7 +459,7 @@
"'-33.12131'"
]
},
"execution_count": 21,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@@ -494,7 +477,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 28,
"metadata": {},
"outputs": [
{
@@ -503,7 +486,7 @@
"'00000000000003.12131'"
]
},
"execution_count": 22,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
@@ -521,7 +504,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 29,
"metadata": {},
"outputs": [
{
@@ -547,7 +530,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 30,
"metadata": {},
"outputs": [
{


+ 188
- 118
0_python/3_Data_Structure_1.ipynb
File diff suppressed because it is too large
View File


+ 13
- 5
0_python/4_Data_Structure_2.ipynb View File

@@ -19,7 +19,9 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"String0 = 'Taj Mahal is beautiful'\n",
@@ -665,7 +667,9 @@
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f = ' hello '"
@@ -708,7 +712,9 @@
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"f = ' ***----hello---******* '"
@@ -904,7 +910,9 @@
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"names = ['One', 'Two', 'Three', 'Four', 'Five']\n",
@@ -1192,7 +1200,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.5.4"
}
},
"nbformat": 4,


+ 4
- 2
0_python/5_Control_Flow.ipynb View File

@@ -49,7 +49,9 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = 4\n",
@@ -648,7 +650,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.5.4"
}
},
"nbformat": 4,


+ 1
- 1
0_python/README.md View File

@@ -37,7 +37,7 @@ Python 是一门上手简单、功能强大、通用型的脚本编程语言。

## 参考资料
### 视频教程
* [《90分钟学会Python》](https://www.bilibili.com/video/BV1Uz4y167xY)
* [《90分钟学会Python》](https://www.bilibili.com/video/BV1oZ4y1N7ei?p=9) (推荐)
* [《零基础入门学习Python》教学视频](https://www.bilibili.com/video/BV1c4411e77t)

### 教程


Loading…
Cancel
Save