Skip to content

Commit 95dea65

Browse files
committed
* fix typo
1 parent 5a30f57 commit 95dea65

File tree

2 files changed

+158
-158
lines changed

2 files changed

+158
-158
lines changed

101-Python入门.ipynb

+77-77
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"metadata": {
33
"celltoolbar": "Slideshow",
44
"name": "",
5-
"signature": "sha256:b40fd47c55e8070830538cdd83933a172f70802dac44eb4836a43e3de5d7221e"
5+
"signature": "sha256:7ca92165037692606a3b404d1d2be3afacf7a5404c7a038c1ed44ebf258f9fc8"
66
},
77
"nbformat": 3,
88
"nbformat_minor": 0,
@@ -2464,7 +2464,7 @@
24642464
"output_type": "stream",
24652465
"stream": "stdout",
24662466
"text": [
2467-
"-rw-r--r-- 1 shell shell 111 10\u6708 28 20:00 testmod.py\r\n"
2467+
"-rw-r--r-- 1 shell shell 111 10\u6708 28 20:06 testmod.py\r\n"
24682468
]
24692469
}
24702470
],
@@ -2643,8 +2643,8 @@
26432643
"output_type": "stream",
26442644
"stream": "stdout",
26452645
"text": [
2646-
"-rw-r--r-- 1 shell shell 111 10\u6708 28 20:00 testmod.py\r\n",
2647-
"-rw-r--r-- 1 shell shell 333 10\u6708 28 20:00 testmod.pyc\r\n"
2646+
"-rw-r--r-- 1 shell shell 111 10\u6708 28 20:06 testmod.py\r\n",
2647+
"-rw-r--r-- 1 shell shell 333 10\u6708 28 20:06 testmod.pyc\r\n"
26482648
]
26492649
}
26502650
],
@@ -3937,7 +3937,7 @@
39373937
"output_type": "stream",
39383938
"stream": "stdout",
39393939
"text": [
3940-
"<__main__.Person instance at 0x7f2bac0b0128>\n"
3940+
"<__main__.Person instance at 0x7f7fbc419128>\n"
39413941
]
39423942
}
39433943
],
@@ -4848,7 +4848,7 @@
48484848
"output_type": "stream",
48494849
"stream": "stdout",
48504850
"text": [
4851-
"-rw-r--r-- 1 shell shell 95 10\u6708 28 20:00 poem.txt\r\n"
4851+
"-rw-r--r-- 1 shell shell 95 10\u6708 28 20:07 poem.txt\r\n"
48524852
]
48534853
}
48544854
],
@@ -4883,65 +4883,6 @@
48834883
"\u4ee5\u4e0a\u7686\u662flinux\u6307\u4ee4\uff0c\u56e0\u6b64\u4e0d\u80fd\uff08\u4e5f\u4e0d\u9700\u8981\uff09\u5728windows\u4e0a\u6267\u884c\u3002windows\u4e0a\u5bf9\u5e94\u7684\u884c\u4e3a\u4e3adir\uff0ctype\uff0c\u548cdel\u3002"
48844884
]
48854885
},
4886-
{
4887-
"cell_type": "markdown",
4888-
"metadata": {
4889-
"slideshow": {
4890-
"slide_type": "subslide"
4891-
}
4892-
},
4893-
"source": [
4894-
"## with\n",
4895-
"\n",
4896-
"with\u53ef\u4ee5\u5728\u63a8\u51fa\u533a\u5757\u65f6\u81ea\u52a8\u5173\u95ed\u6587\u4ef6\uff0c\u800c\u4e14\u5bf9\u5f02\u5e38\u5b89\u5168\uff08\u5f02\u5e38\u5728\u4e0b\u4e00\u8282\u8bb2\uff09\u3002\n",
4897-
"\n",
4898-
"with\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u6587\u4ef6\uff0c\u800c\u4e14\u53ef\u4ee5\u7528\u4e8e\u5f88\u591a\u9700\u8981\u5728\u79bb\u5f00\u533a\u57df\u65f6\u81ea\u52a8\u5173\u95ed\u7684\u5bf9\u8c61\uff0c\u4f8b\u5982\u9501\u3002"
4899-
]
4900-
},
4901-
{
4902-
"cell_type": "code",
4903-
"collapsed": false,
4904-
"input": [
4905-
"import sys\n",
4906-
"with open(\"poem.txt\") as f:\n",
4907-
" for line in f:\n",
4908-
" sys.stdout.write(line)"
4909-
],
4910-
"language": "python",
4911-
"metadata": {
4912-
"slideshow": {
4913-
"slide_type": "-"
4914-
}
4915-
},
4916-
"outputs": [
4917-
{
4918-
"output_type": "stream",
4919-
"stream": "stdout",
4920-
"text": [
4921-
"Programming is fun\n",
4922-
"When the work is done\n",
4923-
"if you wanna make your work also fun:\n",
4924-
" use Python!\n"
4925-
]
4926-
}
4927-
],
4928-
"prompt_number": 111
4929-
},
4930-
{
4931-
"cell_type": "code",
4932-
"collapsed": false,
4933-
"input": [
4934-
"!rm -f poem.txt"
4935-
],
4936-
"language": "python",
4937-
"metadata": {
4938-
"slideshow": {
4939-
"slide_type": "skip"
4940-
}
4941-
},
4942-
"outputs": [],
4943-
"prompt_number": 112
4944-
},
49454886
{
49464887
"cell_type": "markdown",
49474888
"metadata": {
@@ -4996,12 +4937,12 @@
49964937
"output_type": "pyerr",
49974938
"traceback": [
49984939
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
4999-
"\u001b[0;32m<ipython-input-113-4a9fe39e6a16>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mPrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello World\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
4940+
"\u001b[0;32m<ipython-input-111-4a9fe39e6a16>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mPrint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Hello World\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
50004941
"\u001b[0;31mNameError\u001b[0m: name 'Print' is not defined"
50014942
]
50024943
}
50034944
],
5004-
"prompt_number": 113
4945+
"prompt_number": 111
50054946
},
50064947
{
50074948
"cell_type": "code",
@@ -5020,7 +4961,7 @@
50204961
]
50214962
}
50224963
],
5023-
"prompt_number": 114
4964+
"prompt_number": 112
50244965
},
50254966
{
50264967
"cell_type": "markdown",
@@ -5036,7 +4977,7 @@
50364977
"\n",
50374978
"\u5f02\u5e38\u8f93\u51fa\u901a\u5e38\u548c\u51fd\u6570\u7684\u8c03\u7528\u987a\u5e8f\u76f8\u540c\uff0c\u548c\u6808\u7684\u987a\u5e8f\u76f8\u53cd\u3002\n",
50384979
"\n",
5039-
"\u6700\u4e0a\u5c42\u7684\u8c03\u7528\uff08\u6700\u5148\u53d1\u751f\u7684\uff09\u5728\u6700\u4e0a\u9762\uff0c\u6700\u540e\u6267\u884c\u5230\u7684\u5730\u65b9\u5728\u6700\u4e0b\u9762\u3002\u6700\u540e\u4e00\u4e2a\u5f02\u5e38\u884c\u5c31\u662f\u4e00\u573a\u53d1\u751f\u7684\u7cbe\u786e\u5730\u70b9\u3002\n",
4980+
"\u6700\u4e0a\u5c42\u7684\u8c03\u7528\uff08\u6700\u5148\u53d1\u751f\u7684\uff09\u5728\u6700\u4e0a\u9762\uff0c\u6700\u540e\u6267\u884c\u5230\u7684\u5730\u65b9\u5728\u6700\u4e0b\u9762\u3002\u6700\u540e\u4e00\u4e2a\u5f02\u5e38\u884c\u5c31\u662f\u5f02\u5e38\u53d1\u751f\u7684\u7cbe\u786e\u5730\u70b9\u3002\n",
50404981
"\n",
50414982
"\u6700\u540e\u4e00\u884c\u662f\u5f02\u5e38\u7684\u540d\u5b57\u548c\u53c2\u6570\u3002"
50424983
]
@@ -5077,14 +5018,14 @@
50775018
"output_type": "pyerr",
50785019
"traceback": [
50795020
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mException\u001b[0m Traceback (most recent call last)",
5080-
"\u001b[0;32m<ipython-input-115-22bfd87adf46>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
5081-
"\u001b[0;32m<ipython-input-115-22bfd87adf46>\u001b[0m in \u001b[0;36mlayer1\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer1 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
5082-
"\u001b[0;32m<ipython-input-115-22bfd87adf46>\u001b[0m in \u001b[0;36mlayer2\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer2 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'arg1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
5021+
"\u001b[0;32m<ipython-input-113-22bfd87adf46>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
5022+
"\u001b[0;32m<ipython-input-113-22bfd87adf46>\u001b[0m in \u001b[0;36mlayer1\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer1\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer1 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
5023+
"\u001b[0;32m<ipython-input-113-22bfd87adf46>\u001b[0m in \u001b[0;36mlayer2\u001b[0;34m()\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mlayer2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'layer2 called'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'arg1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
50835024
"\u001b[0;31mException\u001b[0m: ('arg1', 2)"
50845025
]
50855026
}
50865027
],
5087-
"prompt_number": 115
5028+
"prompt_number": 113
50885029
},
50895030
{
50905031
"cell_type": "markdown",
@@ -5144,7 +5085,7 @@
51445085
]
51455086
}
51465087
],
5147-
"prompt_number": 116
5088+
"prompt_number": 114
51485089
},
51495090
{
51505091
"cell_type": "markdown",
@@ -5203,7 +5144,7 @@
52035144
]
52045145
}
52055146
],
5206-
"prompt_number": 117
5147+
"prompt_number": 115
52075148
},
52085149
{
52095150
"cell_type": "markdown",
@@ -5231,7 +5172,7 @@
52315172
"language": "python",
52325173
"metadata": {},
52335174
"outputs": [],
5234-
"prompt_number": 118
5175+
"prompt_number": 116
52355176
},
52365177
{
52375178
"cell_type": "code",
@@ -5271,7 +5212,7 @@
52715212
]
52725213
}
52735214
],
5274-
"prompt_number": 119
5215+
"prompt_number": 117
52755216
},
52765217
{
52775218
"cell_type": "markdown",
@@ -5330,6 +5271,65 @@
53305271
]
53315272
}
53325273
],
5274+
"prompt_number": 118
5275+
},
5276+
{
5277+
"cell_type": "markdown",
5278+
"metadata": {
5279+
"slideshow": {
5280+
"slide_type": "subslide"
5281+
}
5282+
},
5283+
"source": [
5284+
"## with\n",
5285+
"\n",
5286+
"with\u53ef\u4ee5\u5728\u63a8\u51fa\u533a\u5757\u65f6\u81ea\u52a8\u5173\u95ed\u6587\u4ef6\uff0c\u800c\u4e14\u5bf9\u5f02\u5e38\u5b89\u5168\uff08\u5f02\u5e38\u5728\u4e0b\u4e00\u8282\u8bb2\uff09\u3002\n",
5287+
"\n",
5288+
"with\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8e\u6587\u4ef6\uff0c\u800c\u4e14\u53ef\u4ee5\u7528\u4e8e\u5f88\u591a\u9700\u8981\u5728\u79bb\u5f00\u533a\u57df\u65f6\u81ea\u52a8\u5173\u95ed\u7684\u5bf9\u8c61\uff0c\u4f8b\u5982\u9501\u3002"
5289+
]
5290+
},
5291+
{
5292+
"cell_type": "code",
5293+
"collapsed": false,
5294+
"input": [
5295+
"import sys\n",
5296+
"with open(\"poem.txt\") as f:\n",
5297+
" for line in f:\n",
5298+
" sys.stdout.write(line)"
5299+
],
5300+
"language": "python",
5301+
"metadata": {
5302+
"slideshow": {
5303+
"slide_type": "-"
5304+
}
5305+
},
5306+
"outputs": [
5307+
{
5308+
"output_type": "stream",
5309+
"stream": "stdout",
5310+
"text": [
5311+
"Programming is fun\n",
5312+
"When the work is done\n",
5313+
"if you wanna make your work also fun:\n",
5314+
" use Python!\n"
5315+
]
5316+
}
5317+
],
5318+
"prompt_number": 119
5319+
},
5320+
{
5321+
"cell_type": "code",
5322+
"collapsed": false,
5323+
"input": [
5324+
"!rm -f poem.txt"
5325+
],
5326+
"language": "python",
5327+
"metadata": {
5328+
"slideshow": {
5329+
"slide_type": "skip"
5330+
}
5331+
},
5332+
"outputs": [],
53335333
"prompt_number": 120
53345334
},
53355335
{

0 commit comments

Comments
 (0)