diff --git "a/102-Python350円277円233円351円230円266円.ipynb" "b/102-Python350円277円233円351円230円266円.ipynb" index 9d957f8..7e1386b 100644 --- "a/102-Python350円277円233円351円230円266円.ipynb" +++ "b/102-Python350円277円233円351円230円266円.ipynb" @@ -2,7 +2,7 @@ "metadata": { "celltoolbar": "Slideshow", "name": "", - "signature": "sha256:2be300068ba848743c387dd0d4e6518b899fefd5285bf755572eaa7b78c84773" + "signature": "sha256:32d919bfd4daf7d732f6e411cc1e1adefd45da81e3f98bdbcc7cc18ff499d37c" }, "nbformat": 3, "nbformat_minor": 0, @@ -648,8 +648,8 @@ "output_type": "stream", "stream": "stdout", "text": [ - "CPU times: user 3.66 s, sys: 0 ns, total: 3.66 s\n", - "Wall time: 3.66 s\n" + "CPU times: user 3.28 s, sys: 0 ns, total: 3.28 s\n", + "Wall time: 3.28 s\n" ] }, { @@ -705,7 +705,7 @@ "stream": "stdout", "text": [ "CPU times: user 0 ns, sys: 0 ns, total: 0 ns\n", - "Wall time: 104 \u00b5s\n" + "Wall time: 70.8 \u00b5s\n" ] }, { @@ -772,7 +772,7 @@ "stream": "stdout", "text": [ "CPU times: user 0 ns, sys: 0 ns, total: 0 ns\n", - "Wall time: 83.9 \u00b5s\n" + "Wall time: 56 \u00b5s\n" ] }, { @@ -872,7 +872,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "\n", + "\n", "[2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711]\n" ] } @@ -2005,7 +2005,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "-rw-r--r-- 1 shell shell 72 10\u6708 13 11:49 abc.txt\r\n" + "-rw-r--r-- 1 shell shell 72 11\u6708 7 00:39 abc.txt\r\n" ] } ], @@ -2096,7 +2096,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "-rw-r--r-- 1 shell shell 48 10\u6708 13 11:49 abc.txt\r\n" + "-rw-r--r-- 1 shell shell 48 11\u6708 7 00:39 abc.txt\r\n" ] } ], @@ -2673,7 +2673,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "<_sre.sre_match object at 0x7fc8c9c6e1d0>\n", + "<_sre.sre_match object at 0x7fc1f8083440>\n", "None\n" ] } @@ -2704,10 +2704,10 @@ "output_type": "stream", "stream": "stdout", "text": [ - "<_sre.sre_match object at 0x7fc8c9c6e370>\n", + "<_sre.sre_match object at 0x7fc1f80835e0>\n", "None\n", "None\n", - "<_sre.sre_match object at 0x7fc8c9c6e370>\n" + "<_sre.sre_match object at 0x7fc1f80835e0>\n" ] } ], @@ -2735,7 +2735,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "<_sre.sre_match object at 0x7fc8c9c44458>\n", + "<_sre.sre_match object at 0x7fc1f8059328>\n", "None\n" ] } @@ -2764,7 +2764,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "<_sre.sre_match object at 0x7fc8c9c440c8>\n", + "<_sre.sre_match object at 0x7fc1f8059160>\n", "None\n" ] } @@ -2827,7 +2827,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "-rw-r--r-- 1 shell shell 46 10\u6708 13 11:49 shoplist.data\r\n" + "-rw-r--r-- 1 shell shell 46 11\u6708 7 00:39 shoplist.data\r\n" ] } ], @@ -3178,11 +3178,11 @@ "output_type": "stream", "stream": "stdout", "text": [ - "\u5b59\n", - "\u90d1\n", + "\u5468\n", "\u90d1\n", - "\u5b59\n", - "\u5434\n", + "\u738b\n", + "\u738b\n", + "\u738b\n", "\u94b1\n" ] } @@ -3216,12 +3216,12 @@ "output_type": "stream", "stream": "stdout", "text": [ - "\u8d75\n", "\u94b1\n", - "\u674e\n", - "\u5468\n", + "\u5434\n", "\u90d1\n", - "\u738b\n" + "\u5468\n", + "\u738b\n", + "\u5b59\n" ] } ], @@ -3496,7 +3496,7 @@ "text": [ "\n", "----------------------------------------------------------------------\n", - "Ran 3 tests in 0.004s\n", + "Ran 3 tests in 0.003s\n", "\n", "OK\n" ] @@ -3697,7 +3697,7 @@ "Traceback (most recent call last):\n", " File \"\", line 25, in test_wrong\n", " self.assertFalse(self.r.match('192.168.0.999'))\n", - "AssertionError: <_sre.sre_match object at 0x7fc8c9c8b440> is not false\n", + "AssertionError: <_sre.sre_match object at 0x7fc1f80e96b0> is not false\n", "\n", "----------------------------------------------------------------------\n", "Ran 9 tests in 0.006s\n", @@ -4055,7 +4055,7 @@ }, "source": [ "* \u51fd\u6570\u540d\u5efa\u8bae\u5168\u5c0f\u5199\u3002\u5982\u679c\u6709\u52a9\u4e8e\u9605\u8bfb\uff0c\u53ef\u4ee5\u7528\\_\u3002\u5982\u679c\u548c\u5173\u952e\u5b57\u51b2\u7a81\uff0c\u4e00\u822c\u4f1a\u6539\u4e2a\u540d\u5b57\u6216\u8005\u5728\u540e\u9762\u52a0\\_\u3002\n", - "* \u5185\u90e8\u4f7f\u7528\u7684\u5168\u5c40\u53d8\u91cf\u540d\u89c4\u5219\u540c\u51fd\u6570\u540d\u3002\n", + "* \u5168\u5c40\u53d8\u91cf\u548c\u5c40\u90e8\u53d8\u91cf\u547d\u540d\u89c4\u5219\u540c\u51fd\u6570\u540d\u3002\n", "* \u59cb\u7ec8\u7528self\u6765\u6307\u4ee3\u5bf9\u8c61\u672c\u8eab\uff0c\u4f7f\u7528cls\u6765\u6307\u4ee3\u7c7b\u672c\u8eab\u3002\n", "* \u5e38\u91cf\u59cb\u7ec8\u5168\u5927\u5199\u3002\n", "* \u5982\u679c\u8981\u8bbf\u95ee\u7c7b\u5c5e\u6027\uff0c\u76f4\u63a5\u8bbf\u95ee\u7c7b\u5c5e\u6027\u5373\u53ef\uff0c\u4e0d\u9700\u8981\u989d\u5916\u7684getter/setter\u3002\u56e0\u4e3apython\u5141\u8bb8\u4f60\u4f7f\u7528property\u6765\u91cd\u8f7d\u8fd9\u4e2a\u5c5e\u6027\u3002" @@ -4224,7 +4224,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "Writing calc.py\n" + "Overwriting calc.py\n" ] } ], @@ -4247,7 +4247,17 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: pylint: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "No config file found, using default configuration\r\n", + "************* Module calc\r\n", + "C: 11, 0: Wrong continued indentation (add 6 spaces).\r\n", + " ')': None,\r\n", + " ^ | (bad-continuation)\r\n", + "C: 12, 0: Wrong continued indentation (add 6 spaces).\r\n", + " '+': lambda x, y: x+y,\r\n", + " ^ | (bad-continuation)\r\n", + "C: 13, 0: Wrong continued indentation (add 6 spaces).\r\n", + " '-': lambda x, y: x-y,\r\n", + " ^ | (bad-continuation)\r\n" ] } ], @@ -4266,7 +4276,18 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: pylint: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "No config file found, using default configuration\r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\r\n", + "Global evaluation\r\n", + "-----------------\r\n", + "Your code has been rated at 3.00/10 (previous run: 3.00/10, +0.00)\r\n", + "\r\n" ] } ], @@ -4289,7 +4310,27 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: flake8: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "calc.py:11:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:12:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:13:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:14:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:15:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:15:33: E231 missing whitespace after ','\r\n", + "calc.py:18:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:19:5: E128 continuation line under-indented for visual indent\r\n", + "calc.py:19:12: E231 missing whitespace after ','\r\n", + "calc.py:21:1: E302 expected 2 blank lines, found 1\r\n", + "calc.py:25:17: E701 multiple statements on one line (colon)\r\n", + "calc.py:28:13: E701 multiple statements on one line (colon)\r\n", + "calc.py:29:9: E701 multiple statements on one line (colon)\r\n", + "calc.py:31:1: E302 expected 2 blank lines, found 1\r\n", + "calc.py:33:23: E701 multiple statements on one line (colon)\r\n", + "calc.py:35:1: E302 expected 2 blank lines, found 1\r\n", + "calc.py:43:1: E302 expected 2 blank lines, found 1\r\n", + "calc.py:46:20: E701 multiple statements on one line (colon)\r\n", + "calc.py:55:66: E701 multiple statements on one line (colon)\r\n", + "calc.py:62:1: E302 expected 2 blank lines, found 1\r\n", + "calc.py:68:34: W292 no newline at end of file\r\n" ] } ], @@ -4312,7 +4353,11 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/usr/bin/python3: No module named mccabe\r\n" + "31:1: 'find_last_op' 3\r\n", + "43:1: 'eval_exp' 8\r\n", + "21:1: 'parser_exp' 5\r\n", + "62:1: 'calc' 1\r\n", + "35:1: 'force_stack' 1\r\n" ] } ], @@ -4449,7 +4494,23 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: pylint: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "No config file found, using default configuration\r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "************* Module calc\r\n", + "C: 91, 0: Final newline missing (missing-final-newline)\r\n", + "C: 13, 0: Invalid constant name \"op_set\" (invalid-name)\r\n", + "C: 23, 0: Invalid constant name \"op_priority\" (invalid-name)\r\n", + "C: 31, 0: Missing function docstring (missing-docstring)\r\n", + "C: 32, 4: Invalid variable name \"s\" (invalid-name)\r\n", + "C: 33, 8: Invalid variable name \"c\" (invalid-name)\r\n", + "C: 37,12: Invalid variable name \"s\" (invalid-name)\r\n", + "C: 40,12: Invalid variable name \"s\" (invalid-name)\r\n", + "C: 45, 0: Invalid argument name \"l\" (invalid-name)\r\n" ] } ], @@ -4468,7 +4529,18 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: pylint: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "No config file found, using default configuration\r\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\r\n", + "Global evaluation\r\n", + "-----------------\r\n", + "Your code has been rated at 6.42/10 (previous run: 6.42/10, +0.00)\r\n", + "\r\n" ] } ], @@ -4491,7 +4563,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: flake8: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "calc.py:91:34: W292 no newline at end of file\r\n" ] } ], @@ -4514,7 +4586,7 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: flake8: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "calc.py:91:34: W292 no newline at end of file\r\n" ] } ], @@ -4550,7 +4622,18 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: python-coverage: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "* 2.0 3.0 => 6.0\r\n", + "+ 6.0 1.0 => 7.0\r\n", + "7.0\r\n", + "* 2.0 3.0 => 6.0\r\n", + "+ 1.0 6.0 => 7.0\r\n", + "7.0\r\n", + "/ 2.5 10.0 => 0.25\r\n", + "+ 1.1 0.25 => 1.35\r\n", + "* 1.35 3.0 => 4.05\r\n", + "/ 4.05 4.0 => 1.0125\r\n", + "+ 1.0125 1.0 => 2.0125\r\n", + "2.0125\r\n" ] } ], @@ -4569,7 +4652,9 @@ "output_type": "stream", "stream": "stdout", "text": [ - "/bin/sh: python-coverage: \u672a\u627e\u5230\u547d\u4ee4\r\n" + "Name Stmts Miss Cover Missing\r\n", + "---------------------------------------\r\n", + "calc.py 54 0 100%\r\n" ] } ], diff --git "a/102-Python350円277円233円351円230円266円.slides.html" "b/102-Python350円277円233円351円230円266円.slides.html" index 8790379..d93367b 100644 --- "a/102-Python350円277円233円351円230円266円.slides.html" +++ "b/102-Python350円277円233円351円230円266円.slides.html" @@ -917,8 +917,8 @@

练习1

-CPU times: user 3.4 s, sys: 16 ms, total: 3.42 s
-Wall time: 3.41 s
+CPU times: user 3.28 s, sys: 0 ns, total: 3.28 s
+Wall time: 3.28 s
 
 
@@ -982,7 +982,7 @@

答案

 CPU times: user 0 ns, sys: 0 ns, total: 0 ns
-Wall time: 78 μs
+Wall time: 70.8 μs
 
 
@@ -1058,7 +1058,7 @@

答案

 CPU times: user 0 ns, sys: 0 ns, total: 0 ns
-Wall time: 81.1 μs
+Wall time: 56 μs
 
 
@@ -1169,7 +1169,7 @@

生成器

-<generator object fib_seq at 0x7f9a124368c0>
+<generator object fib_seq at 0x7fc1f81cc050>
 [2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711]
 
 
@@ -2447,7 +2447,7 @@

Unicode IO

--rw-r--r-- 1 shell shell 72 9月 5 18:14 abc.txt
+-rw-r--r-- 1 shell shell 72 11月 7 00:39 abc.txt
 
 
@@ -2572,7 +2572,7 @@

Unicode IO

--rw-r--r-- 1 shell shell 48 9月 5 18:14 abc.txt
+-rw-r--r-- 1 shell shell 48 11月 7 00:39 abc.txt
 
 
@@ -3167,7 +3167,7 @@

答案

-<_sre.SRE_Match object at 0x7f9a0819a7e8>
+<_sre.SRE_Match object at 0x7fc1f8083440>
 None
 
 
@@ -3205,10 +3205,10 @@

答案

-<_sre.SRE_Match object at 0x7f9a0819a988>
+<_sre.SRE_Match object at 0x7fc1f80835e0>
 None
 None
-<_sre.SRE_Match object at 0x7f9a0819a988>
+<_sre.SRE_Match object at 0x7fc1f80835e0>
 
 
@@ -3243,7 +3243,7 @@

答案

-<_sre.SRE_Match object at 0x7f9a123f53c0>
+<_sre.SRE_Match object at 0x7fc1f8059328>
 None
 
 
@@ -3279,7 +3279,7 @@

答案

-<_sre.SRE_Match object at 0x7f9a123f5750>
+<_sre.SRE_Match object at 0x7fc1f8059160>
 None
 
 
@@ -3357,7 +3357,7 @@

pickle

--rw-r--r-- 1 shell shell 46 9月 5 18:14 shoplist.data
+-rw-r--r-- 1 shell shell 46 11月 7 00:39 shoplist.data
 
 
@@ -3778,12 +3778,12 @@

答案

-吴
-赵
+周
+郑
 王
-孙
-赵
-赵
+王
+王
+钱
 
 
@@ -3824,11 +3824,11 @@

答案

 钱
-孙
-赵
 吴
 郑
-李
+周
+王
+孙
 
 
@@ -4110,7 +4110,7 @@

unittest

 ...
 ----------------------------------------------------------------------
-Ran 3 tests in 0.001s
+Ran 3 tests in 0.003s
 
 OK
 
@@ -4256,10 +4256,10 @@ 

答案

Traceback (most recent call last): File "<ipython-input-74-ea312ac19d96>", line 25, in test_wrong self.assertFalse(self.r.match('192.168.0.999')) -AssertionError: <_sre.SRE_Match object at 0x7f9a080c5850> is not false +AssertionError: <_sre.SRE_Match object at 0x7fc1f80e96b0> is not false ---------------------------------------------------------------------- -Ran 9 tests in 0.003s +Ran 9 tests in 0.006s FAILED (failures=1) @@ -4624,7 +4624,7 @@

命名规则

  • 函数名建议全小写。如果有助于阅读,可以用_。如果和关键字冲突,一般会改个名字或者在后面加_。
  • -
  • 内部使用的全局变量名规则同函数名。
  • +
  • 全局变量和局部变量命名规则同函数名。
  • 始终用self来指代对象本身,使用cls来指代类本身。
  • 常量始终全大写。
  • 如果要访问类属性,直接访问类属性即可,不需要额外的getter/setter。因为python允许你使用property来重载这个属性。
  • @@ -4800,7 +4800,7 @@

    代码检查工具

    -Writing calc.py
    +Overwriting calc.py
     
     
    @@ -4830,6 +4830,7 @@

    代码检查工具

    +No config file found, using default configuration
     ************* Module calc
     C: 11, 0: Wrong continued indentation (add 6 spaces).
     ')': None,
    @@ -4868,10 +4869,11 @@ 

    代码检查工具

    +No config file found, using default configuration
     
     Global evaluation
     -----------------
    -Your code has been rated at 4.00/10 (previous run: 4.00/10, +0.00)
    +Your code has been rated at 3.00/10 (previous run: 3.00/10, +0.00)
     
     
     
    @@ -4952,9 +4954,9 @@

    代码检查工具

    -21:1: 'parser_exp' 5
     31:1: 'find_last_op' 3
     43:1: 'eval_exp' 8
    +21:1: 'parser_exp' 5
     62:1: 'calc' 1
     35:1: 'force_stack' 1
     
    @@ -5107,16 +5109,17 @@ 

    代码检查工具

    +No config file found, using default configuration
     ************* Module calc
     C: 91, 0: Final newline missing (missing-final-newline)
     C: 13, 0: Invalid constant name "op_set" (invalid-name)
     C: 23, 0: Invalid constant name "op_priority" (invalid-name)
    +C: 31, 0: Missing function docstring (missing-docstring)
     C: 32, 4: Invalid variable name "s" (invalid-name)
     C: 33, 8: Invalid variable name "c" (invalid-name)
     C: 37,12: Invalid variable name "s" (invalid-name)
     C: 40,12: Invalid variable name "s" (invalid-name)
     C: 45, 0: Invalid argument name "l" (invalid-name)
    -C: 46, 8: Invalid variable name "e" (invalid-name)
     
     
    @@ -5145,10 +5148,11 @@

    代码检查工具

    +No config file found, using default configuration
     
     Global evaluation
     -----------------
    -Your code has been rated at 7.36/10 (previous run: 7.36/10, +0.00)
    +Your code has been rated at 6.42/10 (previous run: 6.42/10, +0.00)
     
     
     
    @@ -5510,7 +5514,7 @@

    基本兼容性技巧

    -
    In [1]:
    +
    In [93]:
    from __future__ import absolute_import, division, print_function, unicode_literals
    @@ -5543,7 +5547,7 @@ 

    编码

    -
    In [2]:
    +
    In [94]:
    if sys.version_info.major == 3:
    @@ -5578,7 +5582,7 @@ 

    编码

    -
    In [3]:
    +
    In [95]:
    print('hello, world')
    diff --git a/Makefile b/Makefile
    index d8d6ace..f97250b 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -10,7 +10,7 @@ all: build
     %.slides.html: %.ipynb
     	ipython nbconvert --to slides --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.6.2" $<
     
    -build: 101-Python入门.slides.html 102-Python进阶.slides.html
    +build: 101-Python入门.slides.html 102-Python进阶.slides.html 114-Python运维.slides.html
     
     clean:
     	rm -f *.slides.html
    diff --git a/README.md b/README.md
    index 88d01a1..62b4319 100644
    --- a/README.md
    +++ b/README.md
    @@ -1,5 +1,5 @@
     # 课程列表
     
    -* Python入门 [简介](101-Python入门.md) [ipynb](101-Python入门.ipynb) [slide](http://shell909090.org/learn-python/101-Python%E5%85%A5%E9%97%A8.slides.html)
    -* Python进阶 [简介](102-Python进阶.md) [ipynb](102-Python进阶.ipynb) [slide](http://shell909090.org/learn-python/102-Python%E8%BF%9B%E9%98%B6.slides.html)
    +* Python入门 [简介](101-Python入门.md) [ipynb](101-Python入门.ipynb) [slide](http://shell909090.github.io/learn-python/101-Python%E5%85%A5%E9%97%A8.slides.html)
    +* Python进阶 [简介](102-Python进阶.md) [ipynb](102-Python进阶.ipynb) [slide](http://shell909090.github.io/learn-python/102-Python%E8%BF%9B%E9%98%B6.slides.html)
     
    

    AltStyle によって変換されたページ (->オリジナル) /