From 952736c367f355f634b3eca44c49e00c23a762eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E4=B9=9D=E9=BC=8E?= <109224573@qq.com> Date: Thu, 23 Sep 2021 10:27:24 +0800 Subject: [PATCH 1/2] Use https for image.iswbm.com --- README.md | 6 +++--- md2rst.py | 10 +++++----- pdf_maker.py | 2 +- source/_static/js/readmore.js | 2 +- source/aboutme.rst | 2 +- source/c01/c01_01.md | 4 ++-- source/c01/c01_01.rst | 4 ++-- source/c01/c01_02.md | 4 ++-- source/c01/c01_02.rst | 4 ++-- source/c01/c01_03.md | 4 ++-- source/c01/c01_03.rst | 4 ++-- source/c01/c01_04.md | 4 ++-- source/c01/c01_04.rst | 4 ++-- source/c01/c01_05.md | 4 ++-- source/c01/c01_05.rst | 4 ++-- source/c01/c01_06.md | 4 ++-- source/c01/c01_06.rst | 4 ++-- source/c01/c01_07.md | 4 ++-- source/c01/c01_07.rst | 4 ++-- source/c01/c01_08.md | 4 ++-- source/c01/c01_08.rst | 4 ++-- source/c01/c01_09.md | 4 ++-- source/c01/c01_09.rst | 4 ++-- source/c01/c01_10.md | 4 ++-- source/c01/c01_10.rst | 4 ++-- source/c01/c01_11.md | 4 ++-- source/c01/c01_11.rst | 4 ++-- source/c01/c01_12.md | 4 ++-- source/c01/c01_12.rst | 4 ++-- source/c01/c01_13.md | 4 ++-- source/c01/c01_13.rst | 4 ++-- source/c01/c01_14.md | 4 ++-- source/c01/c01_14.rst | 4 ++-- source/c01/c01_15.md | 14 +++++++------- source/c01/c01_15.rst | 14 +++++++------- source/c01/c01_16.md | 4 ++-- source/c01/c01_16.rst | 4 ++-- source/c01/c01_17.md | 6 +++--- source/c01/c01_17.rst | 6 +++--- source/c01/c01_18.md | 4 ++-- source/c01/c01_18.rst | 4 ++-- source/c01/c01_19.md | 4 ++-- source/c01/c01_19.rst | 4 ++-- source/c01/c01_20.md | 6 +++--- source/c01/c01_20.rst | 6 +++--- source/c01/c01_21.md | 4 ++-- source/c01/c01_21.rst | 4 ++-- source/c01/c01_22.md | 8 ++++---- source/c01/c01_22.rst | 8 ++++---- source/c01/c01_23.md | 4 ++-- source/c01/c01_23.rst | 4 ++-- source/c01/c01_24.md | 4 ++-- source/c01/c01_24.rst | 4 ++-- source/c01/c01_25.md | 4 ++-- source/c01/c01_25.rst | 4 ++-- source/c01/c01_26.md | 4 ++-- source/c01/c01_26.rst | 4 ++-- source/c01/c01_27.md | 4 ++-- source/c01/c01_27.rst | 4 ++-- source/c01/c01_28.md | 4 ++-- source/c01/c01_28.rst | 4 ++-- source/c01/c01_29.md | 4 ++-- source/c01/c01_29.rst | 4 ++-- source/c01/c01_30.md | 4 ++-- source/c01/c01_30.rst | 4 ++-- source/c01/c01_31.md | 6 +++--- source/c01/c01_31.rst | 6 +++--- source/c01/c01_32.md | 4 ++-- source/c01/c01_32.rst | 4 ++-- source/c02/c02_01.md | 4 ++-- source/c02/c02_01.rst | 4 ++-- source/c02/c02_02.md | 4 ++-- source/c02/c02_02.rst | 4 ++-- source/c02/c02_03.md | 4 ++-- source/c02/c02_03.rst | 4 ++-- source/c02/c02_04.md | 4 ++-- source/c02/c02_04.rst | 4 ++-- source/c02/c02_05.md | 4 ++-- source/c02/c02_05.rst | 4 ++-- source/c02/c02_06.md | 6 +++--- source/c02/c02_06.rst | 6 +++--- source/c02/c02_07.md | 6 +++--- source/c02/c02_07.rst | 6 +++--- source/c02/c02_08.md | 4 ++-- source/c02/c02_08.rst | 4 ++-- source/c02/c02_09.md | 6 +++--- source/c02/c02_09.rst | 6 +++--- source/c02/c02_10.md | 8 ++++---- source/c02/c02_10.rst | 8 ++++---- source/c02/c02_11.md | 10 +++++----- source/c02/c02_11.rst | 10 +++++----- source/c02/c02_12.md | 14 +++++++------- source/c02/c02_12.rst | 14 +++++++------- source/c02/c02_13.md | 12 ++++++------ source/c02/c02_13.rst | 12 ++++++------ source/c02/c02_14.md | 10 +++++----- source/c02/c02_14.rst | 10 +++++----- source/c02/c02_15.md | 8 ++++---- source/c02/c02_15.rst | 8 ++++---- source/c02/c02_16.md | 10 +++++----- source/c02/c02_16.rst | 10 +++++----- source/c02/c02_17.md | 4 ++-- source/c02/c02_17.rst | 4 ++-- source/c02/c02_18.md | 6 +++--- source/c02/c02_18.rst | 6 +++--- source/c02/c02_19.md | 4 ++-- source/c02/c02_19.rst | 4 ++-- source/c02/c02_20.md | 4 ++-- source/c02/c02_20.rst | 4 ++-- source/c02/c02_21.md | 4 ++-- source/c02/c02_21.rst | 4 ++-- source/c02/c02_22.md | 8 ++++---- source/c02/c02_22.rst | 8 ++++---- source/c02/c02_23.md | 4 ++-- source/c02/c02_23.rst | 4 ++-- source/c03/c03_01.md | 4 ++-- source/c03/c03_01.rst | 4 ++-- source/c03/c03_02.md | 4 ++-- source/c03/c03_02.rst | 4 ++-- source/c03/c03_03.md | 4 ++-- source/c03/c03_03.rst | 4 ++-- source/c03/c03_04.md | 4 ++-- source/c03/c03_04.rst | 4 ++-- source/c03/c03_05.md | 4 ++-- source/c03/c03_05.rst | 4 ++-- source/c03/c03_06.md | 6 +++--- source/c03/c03_06.rst | 6 +++--- source/c03/c03_07.md | 4 ++-- source/c03/c03_07.rst | 4 ++-- source/c03/c03_08.md | 12 ++++++------ source/c03/c03_08.rst | 12 ++++++------ source/c03/c03_09.md | 4 ++-- source/c03/c03_09.rst | 4 ++-- source/c03/c03_10.md | 6 +++--- source/c03/c03_10.rst | 6 +++--- source/c03/c03_11.md | 4 ++-- source/c03/c03_11.rst | 4 ++-- source/c03/c03_12.md | 4 ++-- source/c03/c03_12.rst | 4 ++-- source/c04/c04_01.md | 6 +++--- source/c04/c04_01.rst | 6 +++--- source/c04/c04_02.md | 14 +++++++------- source/c04/c04_02.rst | 14 +++++++------- source/c04/c04_03.md | 4 ++-- source/c04/c04_03.rst | 4 ++-- source/c05/c05_01.md | 4 ++-- source/c05/c05_01.rst | 4 ++-- source/c05/c05_02.md | 4 ++-- source/c05/c05_02.rst | 4 ++-- source/c05/c05_03.md | 4 ++-- source/c05/c05_03.rst | 4 ++-- source/c05/c05_04.md | 4 ++-- source/c05/c05_04.rst | 4 ++-- source/c05/c05_05.md | 4 ++-- source/c05/c05_05.rst | 4 ++-- source/c05/c05_06.md | 4 ++-- source/c05/c05_06.rst | 4 ++-- source/c05/c05_07.md | 4 ++-- source/c05/c05_07.rst | 4 ++-- source/c05/c05_08.md | 4 ++-- source/c05/c05_08.rst | 4 ++-- source/c05/c05_09.md | 4 ++-- source/c05/c05_09.rst | 4 ++-- source/c05/c05_10.md | 8 ++++---- source/c05/c05_10.rst | 8 ++++---- source/c05/c05_11.md | 6 +++--- source/c05/c05_11.rst | 6 +++--- source/c05/c05_12.md | 4 ++-- source/c05/c05_12.rst | 4 ++-- source/c05/c05_13.md | 4 ++-- source/c05/c05_13.rst | 4 ++-- source/c05/c05_14.md | 4 ++-- source/c05/c05_14.rst | 4 ++-- source/c05/c05_15.md | 4 ++-- source/c05/c05_15.rst | 4 ++-- source/c05/c05_16.md | 4 ++-- source/c05/c05_16.rst | 4 ++-- source/c05/c05_17.md | 4 ++-- source/c05/c05_17.rst | 4 ++-- source/c05/c05_18.md | 4 ++-- source/c05/c05_18.rst | 4 ++-- source/c05/c05_19.md | 4 ++-- source/c05/c05_19.rst | 4 ++-- source/c05/c05_20.md | 4 ++-- source/c05/c05_20.rst | 4 ++-- source/c05/c05_21.md | 4 ++-- source/c05/c05_21.rst | 4 ++-- source/c05/c05_22.md | 4 ++-- source/c05/c05_22.rst | 4 ++-- source/c05/c05_23.md | 4 ++-- source/c05/c05_23.rst | 4 ++-- source/c05/c05_24.md | 4 ++-- source/c05/c05_24.rst | 4 ++-- source/c05/c05_25.md | 4 ++-- source/c05/c05_25.rst | 4 ++-- source/c05/c05_26.md | 4 ++-- source/c05/c05_26.rst | 4 ++-- source/c05/c05_27.md | 4 ++-- source/c05/c05_27.rst | 4 ++-- source/c05/c05_28.md | 6 +++--- source/c05/c05_28.rst | 6 +++--- source/c05/c05_29.md | 4 ++-- source/c05/c05_29.rst | 4 ++-- source/c05/c05_30.md | 4 ++-- source/c05/c05_30.rst | 4 ++-- source/c05/c05_31.md | 12 ++++++------ source/c05/c05_31.rst | 12 ++++++------ source/c05/c05_32.md | 4 ++-- source/c05/c05_32.rst | 4 ++-- source/c06/c06_01.md | 4 ++-- source/c06/c06_01.rst | 4 ++-- source/c06/c06_02.md | 6 +++--- source/c06/c06_02.rst | 6 +++--- source/c06/c06_03.md | 4 ++-- source/c06/c06_03.rst | 4 ++-- source/c06/c06_04.md | 10 +++++----- source/c06/c06_04.rst | 10 +++++----- source/c06/c06_05.md | 6 +++--- source/c06/c06_05.rst | 6 +++--- source/c06/c06_06.md | 6 +++--- source/c06/c06_06.rst | 6 +++--- source/c06/c06_07.md | 4 ++-- source/c06/c06_07.rst | 4 ++-- source/c06/c06_08.md | 4 ++-- source/c06/c06_08.rst | 4 ++-- source/c06/c06_09.md | 4 ++-- source/c06/c06_09.rst | 4 ++-- source/c06/c06_10.md | 4 ++-- source/c06/c06_10.rst | 4 ++-- source/c06/c06_11.md | 4 ++-- source/c06/c06_11.rst | 4 ++-- source/c06/c06_12.md | 4 ++-- source/c06/c06_12.rst | 4 ++-- source/c07/c07_01.md | 14 +++++++------- source/c07/c07_01.rst | 14 +++++++------- source/c07/c07_02.md | 24 ++++++++++++------------ source/c07/c07_02.rst | 24 ++++++++++++------------ source/c07/c07_03.md | 4 ++-- source/c07/c07_03.rst | 4 ++-- source/c07/c07_04.md | 6 +++--- source/c07/c07_04.rst | 6 +++--- source/c07/c07_05.md | 4 ++-- source/c07/c07_05.rst | 4 ++-- source/c07/c07_06.md | 12 ++++++------ source/c07/c07_06.rst | 12 ++++++------ source/c07/c07_07.md | 6 +++--- source/c07/c07_07.rst | 6 +++--- source/c07/c07_08.md | 4 ++-- source/c07/c07_08.rst | 4 ++-- source/c07/c07_09.md | 4 ++-- source/c07/c07_09.rst | 4 ++-- source/c07/c07_10.md | 8 ++++---- source/c07/c07_10.rst | 8 ++++---- source/c07/c07_11.md | 4 ++-- source/c07/c07_11.rst | 4 ++-- source/c07/c07_12.md | 10 +++++----- source/c07/c07_12.rst | 10 +++++----- source/c07/c07_13.md | 4 ++-- source/c07/c07_13.rst | 4 ++-- source/chapters/p01.rst | 2 +- source/chapters/p02.rst | 2 +- source/chapters/p03.rst | 2 +- source/chapters/p04.rst | 2 +- source/chapters/p05.rst | 2 +- source/chapters/p06.rst | 2 +- source/chapters/p07.rst | 2 +- source/index.rst | 2 +- source/preface.rst | 2 +- source/roadmap.rst | 2 +- 269 files changed, 709 insertions(+), 709 deletions(-) diff --git a/README.md b/README.md index 2db7937..21477b8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ - +
diff --git a/md2rst.py b/md2rst.py index 8567b15..e7846d4 100644 --- a/md2rst.py +++ b/md2rst.py @@ -26,30 +26,30 @@ base_link = "http://python.iswbm.com/en/latest/" readme_header = ''' - + ## [项目主页](http://python.iswbm.com/) 在线阅读:[Python 编程时光](http://python.iswbm.com/) - + ## 文章结构 - + ''' readme_tooter = ''' --- - + ''' diff --git a/pdf_maker.py b/pdf_maker.py index 4f37fa3..7a80949 100644 --- a/pdf_maker.py +++ b/pdf_maker.py @@ -33,7 +33,7 @@ if fileinput.isfirstline(): count += 1 if count%5 == 0: - write("", end="\n\n") + write("", end="\n\n") if line.startswith("# "): line = line.replace("# ", "## ") diff --git a/source/_static/js/readmore.js b/source/_static/js/readmore.js index 1e0fe54..da735ca 100644 --- a/source/_static/js/readmore.js +++ b/source/_static/js/readmore.js @@ -40,7 +40,7 @@ var setIdTimer = setInterval(function () { id: id, blogId: '15406-1578143418297-890', name: 'Python编程时光', - qrcode: 'http://image.iswbm.com/20200104210733.png', + qrcode: 'https://image.iswbm.com/20200104210733.png', keyword: '1024' }); } diff --git a/source/aboutme.rst b/source/aboutme.rst index b32bed2..38337b2 100755 --- a/source/aboutme.rst +++ b/source/aboutme.rst @@ -10,5 +10,5 @@ -------------------------------------------- -.. image:: http://image.iswbm.com/20200607174235.png +.. image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_01.md b/source/c01/c01_01.md index 1c6a88c..594fd43 100644 --- a/source/c01/c01_01.md +++ b/source/c01/c01_01.md @@ -1,6 +1,6 @@ # 1.1 默默无闻的省略号很好用 - + 在Python中,一切皆对象,省略号也不例外。 @@ -63,4 +63,4 @@ ok - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_01.rst b/source/c01/c01_01.rst index c392c51..710ac07 100644 --- a/source/c01/c01_01.rst +++ b/source/c01/c01_01.rst @@ -64,6 +64,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_02.md b/source/c01/c01_02.md index d0e795e..caafd4f 100644 --- a/source/c01/c01_02.md +++ b/source/c01/c01_02.md @@ -1,6 +1,6 @@ # 1.2 使用 end 来结束代码块 - + 有不少编程语言,循环、判断代码块需要用 end 标明结束,这样一定程度上会使代码逻辑更加清晰一点。 @@ -34,4 +34,4 @@ print(my_abs(-10)) - + diff --git a/source/c01/c01_02.rst b/source/c01/c01_02.rst index 488f13c..369bb48 100644 --- a/source/c01/c01_02.rst +++ b/source/c01/c01_02.rst @@ -36,6 +36,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_03.md b/source/c01/c01_03.md index d62333e..e391713 100644 --- a/source/c01/c01_03.md +++ b/source/c01/c01_03.md @@ -1,5 +1,5 @@ # 1.3 可直接运行的 zip 包 - + 我们可以经常看到有 Python 包,居然可以以 zip 包进行发布,并且可以不用解压直接使用。 @@ -36,4 +36,4 @@ def add(x, y): - + diff --git a/source/c01/c01_03.rst b/source/c01/c01_03.rst index e1420ad..2a08709 100644 --- a/source/c01/c01_03.rst +++ b/source/c01/c01_03.rst @@ -40,6 +40,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_04.md b/source/c01/c01_04.md index 996e95b..e70801d 100644 --- a/source/c01/c01_04.md +++ b/source/c01/c01_04.md @@ -1,5 +1,5 @@ # 1.4 反斜杠的倔强: 不写最后 - + `\` 在 Python 中的用法主要有两种 @@ -50,4 +50,4 @@ SyntaxError: EOL while scanning string literal - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_04.rst b/source/c01/c01_04.rst index ba81d2c..4fa2152 100644 --- a/source/c01/c01_04.rst +++ b/source/c01/c01_04.rst @@ -50,6 +50,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_05.md b/source/c01/c01_05.md index a6eca89..f05fc2b 100644 --- a/source/c01/c01_05.md +++ b/source/c01/c01_05.md @@ -1,5 +1,5 @@ # 1.5 如何修改解释器提示符 - + 这个当做今天的一个小彩蛋吧。应该算是比较冷门的,估计知道的人很少了吧。 @@ -33,4 +33,4 @@ Python编程时光>>>for i in range(2): - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_05.rst b/source/c01/c01_05.rst index ca73f7a..a36a86a 100644 --- a/source/c01/c01_05.rst +++ b/source/c01/c01_05.rst @@ -35,6 +35,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_06.md b/source/c01/c01_06.md index 9d7d5f8..ae255b3 100644 --- a/source/c01/c01_06.md +++ b/source/c01/c01_06.md @@ -1,5 +1,5 @@ # 1.6 简洁而优雅的链式比较 - + 先给你看一个示例: @@ -26,4 +26,4 @@ False 这个用法叫做链式比较。 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_06.rst b/source/c01/c01_06.rst index 86c4ca7..80f14a7 100644 --- a/source/c01/c01_06.rst +++ b/source/c01/c01_06.rst @@ -30,6 +30,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_07.md b/source/c01/c01_07.md index 2a6144c..19ce3ae 100644 --- a/source/c01/c01_07.md +++ b/source/c01/c01_07.md @@ -1,5 +1,5 @@ # 1.7 and 和 or 的短路效应 - + and 和 or 是我们再熟悉不过的两个逻辑运算符,在 Python 也有它的妙用。 @@ -16,4 +16,4 @@ and 和 or 是我们再熟悉不过的两个逻辑运算符,在 Python 也有 - + diff --git a/source/c01/c01_07.rst b/source/c01/c01_07.rst index e9e9b1a..a965645 100644 --- a/source/c01/c01_07.rst +++ b/source/c01/c01_07.rst @@ -18,6 +18,6 @@ and 和 or 是我们再熟悉不过的两个逻辑运算符,在 Python 也有 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_08.md b/source/c01/c01_08.md index 92b2c2a..a24380e 100644 --- a/source/c01/c01_08.md +++ b/source/c01/c01_08.md @@ -1,5 +1,5 @@ # 1.8 连接多个列表最极客的方式 - + ```python >>> a = [1,2] @@ -10,4 +10,4 @@ [1, 2, 3, 4, 5, 6] ``` - + diff --git a/source/c01/c01_08.rst b/source/c01/c01_08.rst index bf54908..ccb5205 100644 --- a/source/c01/c01_08.rst +++ b/source/c01/c01_08.rst @@ -14,6 +14,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_09.md b/source/c01/c01_09.md index e950dc8..f2cda4f 100644 --- a/source/c01/c01_09.md +++ b/source/c01/c01_09.md @@ -1,5 +1,5 @@ # 1.9 字典居然是可以排序的? - + 在 Python 3.6 之前字典不可排序的思想,似乎已经根深蒂固。 @@ -23,4 +23,4 @@ - + diff --git a/source/c01/c01_09.rst b/source/c01/c01_09.rst index 4c4e28e..abfa596 100644 --- a/source/c01/c01_09.rst +++ b/source/c01/c01_09.rst @@ -26,6 +26,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_10.md b/source/c01/c01_10.md index 67588d3..c1f0976 100644 --- a/source/c01/c01_10.md +++ b/source/c01/c01_10.md @@ -1,5 +1,5 @@ # 1.10 哪些情况下不需要续行符? - + 在写代码时,为了代码的可读性,代码的排版是尤为重要的。 @@ -47,4 +47,4 @@ talk is cheap,show me the code. - + diff --git a/source/c01/c01_10.rst b/source/c01/c01_10.rst index d18579f..b1adc5a 100644 --- a/source/c01/c01_10.rst +++ b/source/c01/c01_10.rst @@ -49,6 +49,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_11.md b/source/c01/c01_11.md index 08dc826..a3fa4e8 100644 --- a/source/c01/c01_11.md +++ b/source/c01/c01_11.md @@ -1,5 +1,5 @@ # 1.11 用户无感知的小整数池 - + 为避免整数频繁申请和销毁内存空间,Python 定义了一个小整数池 [-5, 256] 这些整数对象是提前建立好的,不会被垃圾回收。 @@ -30,4 +30,4 @@ True 因为当你在同一行里,同时给两个变量赋同一值时,解释器知道这个对象已经生成,那么它就会引用到同一个对象。如果分成两行的话,解释器并不知道这个对象已经存在了,就会重新申请内存存放这个对象。 - + diff --git a/source/c01/c01_11.rst b/source/c01/c01_11.rst index 23f245a..31547ba 100644 --- a/source/c01/c01_11.rst +++ b/source/c01/c01_11.rst @@ -36,6 +36,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_12.md b/source/c01/c01_12.md index 0ede967..8a0c997 100644 --- a/source/c01/c01_12.md +++ b/source/c01/c01_12.md @@ -1,5 +1,5 @@ # 1.12 神奇的 intern 机制 - + 字符串类型作为Python中最常用的数据类型之一,Python解释器为了提高字符串使用的效率和使用性能,做了很多优化。 @@ -41,4 +41,4 @@ False - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_12.rst b/source/c01/c01_12.rst index c9cbdab..57a0ea3 100644 --- a/source/c01/c01_12.rst +++ b/source/c01/c01_12.rst @@ -44,6 +44,6 @@ intern(字符串驻留)的技术来提高字符串效率,什么是intern |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_13.md b/source/c01/c01_13.md index 7c24b7c..4e9e984 100644 --- a/source/c01/c01_13.md +++ b/source/c01/c01_13.md @@ -1,5 +1,5 @@ # 1.13 site-packages和 dist-packages - + 如果你足够细心,你会在你的机器上,有些包是安装在 **site-packages** 下,而有些包安装在 **dist-packages** 下。 @@ -21,4 +21,4 @@ Debian 这么设计的原因,是为了减少不同来源的 Python 之间产 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_13.rst b/source/c01/c01_13.rst index 24ea911..131fd00 100644 --- a/source/c01/c01_13.rst +++ b/source/c01/c01_13.rst @@ -28,6 +28,6 @@ Debian 这么设计的原因,是为了减少不同来源的 Python 之间产 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_14.md b/source/c01/c01_14.md index d9ee720..3ab3094 100644 --- a/source/c01/c01_14.md +++ b/source/c01/c01_14.md @@ -1,5 +1,5 @@ # 1.14 argument 和 parameter 的区别? - + arguments 和 parameter 的翻译都是参数,在中文场景下,二者混用基本没有问题,毕竟都叫参数嘛。 @@ -19,4 +19,4 @@ output_msg("error") - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_14.rst b/source/c01/c01_14.rst index 2fe2f94..d974d67 100644 --- a/source/c01/c01_14.rst +++ b/source/c01/c01_14.rst @@ -24,6 +24,6 @@ arguments 和 parameter |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_15.md b/source/c01/c01_15.md index ec6b0ca..d368887 100644 --- a/source/c01/c01_15.md +++ b/source/c01/c01_15.md @@ -1,5 +1,5 @@ # 1.15 /usr/bin/env python 有什么用? - + 我们经常会在别人的脚本或者项目的入口文件里看到第一行是下面这样 @@ -17,7 +17,7 @@ 稍微接触过 linux 的人都知道 `/usr/bin/python` 就是我们执行 `python` 进入console 模式里的 `python` - + 而当你在可执行文件头里使用 `#!` + `/usr/bin/python` ,意思就是说你得用哪个软件 (python)来执行这个文件。 @@ -25,19 +25,19 @@ 不加的话,你每次执行这个脚本时,都得这样: `python xx.py` , - + 有没有一种方式?可以省去每次都加 `python` 呢? 当然有,你可以文件头里加上`#!/usr/bin/python` ,那么当这个文件有可执行权限 时,只直接写这个脚本文件,就像下面这样。 - + 明白了这个后,再来看看 `!/usr/bin/env python` 这个 又是什么意思 ? 当我执行 `env python` 时,自动进入了 python console 的模式。 - + 这是为什么?和 直接执行 python 好像没什么区别呀 @@ -47,10 +47,10 @@ 具体演示过程,你可以看下面。 - + 那么对于这两者,我们应该使用哪个呢? 个人感觉应该优先使用 `#!/usr/bin/env python`,因为不是所有的机器的 python 解释器都是 `/usr/bin/python` 。 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_15.rst b/source/c01/c01_15.rst index 990627a..c6472e3 100644 --- a/source/c01/c01_15.rst +++ b/source/c01/c01_15.rst @@ -66,11 +66,11 @@ python 解释器都是 ``/usr/bin/python`` 。 |image6| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200331184021.png -.. |image2| image:: http://image.iswbm.com/20200331185034.png -.. |image3| image:: http://image.iswbm.com/20200331184755.png -.. |image4| image:: http://image.iswbm.com/20200331185741.png -.. |image5| image:: http://image.iswbm.com/20200331190224.png -.. |image6| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200331184021.png +.. |image2| image:: https://image.iswbm.com/20200331185034.png +.. |image3| image:: https://image.iswbm.com/20200331184755.png +.. |image4| image:: https://image.iswbm.com/20200331185741.png +.. |image5| image:: https://image.iswbm.com/20200331190224.png +.. |image6| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_16.md b/source/c01/c01_16.md index 8efc82a..28cc3ca 100644 --- a/source/c01/c01_16.md +++ b/source/c01/c01_16.md @@ -1,5 +1,5 @@ # 1.16 dict() 与 {} 生成空字典有什么区别? - + 在初始化一个空字典时,有的人会写 dict(),而有的人会写成 {} @@ -52,4 +52,4 @@ $ python -m dis demo.py 可以发现使用 dict(),会多了个调用函数的过程,而这个过程会有进出栈的操作,相对更加耗时。 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_16.rst b/source/c01/c01_16.rst index a5f3935..49ea74b 100644 --- a/source/c01/c01_16.rst +++ b/source/c01/c01_16.rst @@ -57,6 +57,6 @@ dict(),会多了个调用函数的过程,而这个过程会有进出栈的 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_17.md b/source/c01/c01_17.md index b74307a..7ce4884 100644 --- a/source/c01/c01_17.md +++ b/source/c01/c01_17.md @@ -1,5 +1,5 @@ # 1.17 有趣但没啥用的 import 用法 - + import 是 Python 导包的方式。 @@ -49,6 +49,6 @@ Namespaces are one honking great idea -- let's do more of those! ``` 就会自动打开一个网页。 - + - + diff --git a/source/c01/c01_17.rst b/source/c01/c01_17.rst index 0c6b956..3f32b04 100644 --- a/source/c01/c01_17.rst +++ b/source/c01/c01_17.rst @@ -54,7 +54,7 @@ import 是 Python 导包的方式。 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190511165735.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190511165735.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_18.md b/source/c01/c01_18.md index 0d8d25a..36b6f80 100644 --- a/source/c01/c01_18.md +++ b/source/c01/c01_18.md @@ -1,5 +1,5 @@ # 1.18 正负得负,负负得正 - + 从初中开始,我们就开始接触了`负数` ,并且都知道了`负负得正` 的思想。 @@ -20,4 +20,4 @@ Python 作为一门高级语言,它的编写符合人类的思维逻辑,包 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_18.rst b/source/c01/c01_18.rst index 1b00f6b..a0f46e9 100644 --- a/source/c01/c01_18.rst +++ b/source/c01/c01_18.rst @@ -24,6 +24,6 @@ Python 作为一门高级语言,它的编写符合人类的思维逻辑,包 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_19.md b/source/c01/c01_19.md index 3c5ce5e..9a590c8 100644 --- a/source/c01/c01_19.md +++ b/source/c01/c01_19.md @@ -1,5 +1,5 @@ # 1.19 return不一定都是函数的终点 - + 众所周知,try…finally… 的用法是:不管try里面是正常执行还是有报异常,最终都能保证finally能够执行。 @@ -46,4 +46,4 @@ finally 那结论就出来了,如果 finally 里有显式的 return,那么这个 return 会直接覆盖 try 里的 return,而如果 finally 里没有 显式的 return,那么 try 里的 return 仍然有效。 - + diff --git a/source/c01/c01_19.rst b/source/c01/c01_19.rst index 3d21b69..7039454 100644 --- a/source/c01/c01_19.rst +++ b/source/c01/c01_19.rst @@ -59,6 +59,6 @@ try 里的 return 仍然有效。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_20.md b/source/c01/c01_20.md index b4209c2..e19ecbb 100644 --- a/source/c01/c01_20.md +++ b/source/c01/c01_20.md @@ -1,5 +1,5 @@ # 1.20 字符串里的缝隙是什么? - + 在Python中求一个字符串里,某子字符(串)出现的次数。 @@ -29,7 +29,7 @@ 因此 对于 `aabb` 这个字符串在 Python 来看应该是这样的 - + 理解了这个“**缝隙**” 的概念后,以下这些就好理解了。 @@ -46,4 +46,4 @@ True - + diff --git a/source/c01/c01_20.rst b/source/c01/c01_20.rst index bb252cc..42b2fdc 100644 --- a/source/c01/c01_20.rst +++ b/source/c01/c01_20.rst @@ -48,7 +48,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200509172331.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200509172331.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_21.md b/source/c01/c01_21.md index 81c35a6..fa1749a 100644 --- a/source/c01/c01_21.md +++ b/source/c01/c01_21.md @@ -1,5 +1,5 @@ # 1.21 Python2下 也能使用 print(“”) - + 可能会有不少人,觉得只有 Python 3 才可以使用 print(),而 Python 2 只能使用`print ""`。 @@ -28,4 +28,4 @@ print ("hello") 虽然 在 Python 2.6+ 可以和 Python3.x+ 一样,像函数一样去调用 print ,但是这仅用于两个 python 版本之间的代码兼容,并不是说在 python2.6+下使用 print() 后,就成了函数。 - + diff --git a/source/c01/c01_21.rst b/source/c01/c01_21.rst index 08ec573..7a79d0f 100644 --- a/source/c01/c01_21.rst +++ b/source/c01/c01_21.rst @@ -35,6 +35,6 @@ python2.6+下使用 print() 后,就成了函数。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_22.md b/source/c01/c01_22.md index a700d70..2eb5b13 100644 --- a/source/c01/c01_22.md +++ b/source/c01/c01_22.md @@ -1,5 +1,5 @@ # 1.22 字母也玩起了障眼法 - + 以下我分别在 Python2.7 和 Python 3.7 的 console 模式下,运行了如下代码。 @@ -23,13 +23,13 @@ SyntaxError: invalid syntax 什么?没有截图你不信? - + 如果你在自己的电脑上尝试一下,结果可能是这样的 - + @@ -54,4 +54,4 @@ False 细思恐极,在这里可千万不要得罪同事们,万一离职的时候,对方把你项目里的 `e` 全局替换成 `e`,到时候你就哭去吧,肉眼根本看不出来嘛。 - + diff --git a/source/c01/c01_22.rst b/source/c01/c01_22.rst index 6e2a3df..a0115b3 100644 --- a/source/c01/c01_22.rst +++ b/source/c01/c01_22.rst @@ -54,8 +54,8 @@ |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200509122954.png -.. |image2| image:: http://image.iswbm.com/20200509123107.png -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200509122954.png +.. |image2| image:: https://image.iswbm.com/20200509123107.png +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_23.md b/source/c01/c01_23.md index 097f408..ed9987e 100644 --- a/source/c01/c01_23.md +++ b/source/c01/c01_23.md @@ -1,5 +1,5 @@ # 1.23 数值与字符串的比较 - + 在 Python2 中,数字可以与字符串直接比较。结果是数值永远比字符串小。 @@ -19,4 +19,4 @@ TypeError: '<' not supported between instances of 'int' and 'str' - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_23.rst b/source/c01/c01_23.rst index 3ccef50..891c92f 100644 --- a/source/c01/c01_23.rst +++ b/source/c01/c01_23.rst @@ -21,6 +21,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_24.md b/source/c01/c01_24.md index 3715c29..5ac35bc 100644 --- a/source/c01/c01_24.md +++ b/source/c01/c01_24.md @@ -1,6 +1,6 @@ # 1.24 时有时无的切片异常 - + 这是个简单例子,alist 只有5 个元素,当你取第 6 个元素时,会抛出索引异常。这与我们的认知一致。 @@ -24,4 +24,4 @@ IndexError: list index out of range - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_24.rst b/source/c01/c01_24.rst index 1c65ed7..bff8ad7 100644 --- a/source/c01/c01_24.rst +++ b/source/c01/c01_24.rst @@ -27,6 +27,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_25.md b/source/c01/c01_25.md index 3efec97..7aaf6ed 100644 --- a/source/c01/c01_25.md +++ b/source/c01/c01_25.md @@ -1,5 +1,5 @@ # 1.25 迷一样的字符串 - + 示例一 @@ -56,4 +56,4 @@ True - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_25.rst b/source/c01/c01_25.rst index 139421e..a8d0971 100644 --- a/source/c01/c01_25.rst +++ b/source/c01/c01_25.rst @@ -58,6 +58,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_26.md b/source/c01/c01_26.md index cc9bdcc..85ea892 100644 --- a/source/c01/c01_26.md +++ b/source/c01/c01_26.md @@ -1,5 +1,5 @@ # 1.26 x 与 +x 等价吗? - + 在大多数情况下,这个等式是成立的。 @@ -32,4 +32,4 @@ Counter({'a': 3, 'b': 2}) - + diff --git a/source/c01/c01_26.rst b/source/c01/c01_26.rst index f931fef..9f5f29e 100644 --- a/source/c01/c01_26.rst +++ b/source/c01/c01_26.rst @@ -35,6 +35,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_27.md b/source/c01/c01_27.md index 14d340d..3f2ccf9 100644 --- a/source/c01/c01_27.md +++ b/source/c01/c01_27.md @@ -1,5 +1,5 @@ # 1.27 += 不等同于=+ - + 对列表 进行`+=` 操作相当于 extend,而使用 `=+` 操作是新增了一个列表。 @@ -28,4 +28,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_27.rst b/source/c01/c01_27.rst index 8fbcb37..b3d1d18 100644 --- a/source/c01/c01_27.rst +++ b/source/c01/c01_27.rst @@ -31,6 +31,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_28.md b/source/c01/c01_28.md index 4b1d94e..f3fab56 100644 --- a/source/c01/c01_28.md +++ b/source/c01/c01_28.md @@ -1,5 +1,5 @@ # 1.28 循环中的局部变量泄露 - + 在Python 2中 x 的值在一个循环执行之后被改变了。 @@ -25,4 +25,4 @@ - + diff --git a/source/c01/c01_28.rst b/source/c01/c01_28.rst index 0aee763..29584c9 100644 --- a/source/c01/c01_28.rst +++ b/source/c01/c01_28.rst @@ -27,6 +27,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_29.md b/source/c01/c01_29.md index 82fa43c..7b41db4 100644 --- a/source/c01/c01_29.md +++ b/source/c01/c01_29.md @@ -1,5 +1,5 @@ # 1.29 局部/全局变量傻傻分不清 - + 在开始讲之前,你可以试着运行一下下面这小段代码。 @@ -48,4 +48,4 @@ $ python demo.py - + diff --git a/source/c01/c01_29.rst b/source/c01/c01_29.rst index e049b89..5546d61 100644 --- a/source/c01/c01_29.rst +++ b/source/c01/c01_29.rst @@ -52,6 +52,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_30.md b/source/c01/c01_30.md index 314d418..79c7a31 100644 --- a/source/c01/c01_30.md +++ b/source/c01/c01_30.md @@ -1,5 +1,5 @@ # 1.30 break /continue 和 上下文管理器哪个优先级高? - + 众所周知,在循环体中(无论是 for 还是 while),continue 会用来跳入下一个循环,而 break 则用来跳出某个循环体。 @@ -49,4 +49,4 @@ end: a = 2 1. continue 与 break 一样,如果先遇到上下文管理器会先进行资源的释放 2. 上面只举例了 while 循环体,而 for 循环也是同样的。 - + diff --git a/source/c01/c01_30.rst b/source/c01/c01_30.rst index ce56735..7013cfe 100644 --- a/source/c01/c01_30.rst +++ b/source/c01/c01_30.rst @@ -56,6 +56,6 @@ print 来替代)。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_31.md b/source/c01/c01_31.md index 0558b61..fe7fb18 100644 --- a/source/c01/c01_31.md +++ b/source/c01/c01_31.md @@ -1,6 +1,6 @@ # 1.31 如何像 awk一样分割字符串? - + 若你使用过 Shell 中的 awk 工具,会发现用它来分割字符串是非常方便的。特别是多个连续空格会被当做一个处理。 @@ -61,7 +61,7 @@ split函数不加参数,就能达到 awk 的效果 查看了注释,原来是这个函数会适配 None 的情况,当第一个参数是None的时候,返回第二个参数(可迭代对象)中非空的值,非常方便。 - + 换用函数的写法,可以这样 @@ -78,4 +78,4 @@ split函数不加参数,就能达到 awk 的效果 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_31.rst b/source/c01/c01_31.rst index 5faadc1..82725c9 100644 --- a/source/c01/c01_31.rst +++ b/source/c01/c01_31.rst @@ -83,7 +83,7 @@ split函数不加参数,就能达到 awk 的效果 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200821173708.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200821173708.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c01/c01_32.md b/source/c01/c01_32.md index 59885fc..642fa7d 100644 --- a/source/c01/c01_32.md +++ b/source/c01/c01_32.md @@ -1,6 +1,6 @@ # 1.32 如何让大数变得更易于阅读? - + 当一个数非常大时,可能过百万,也可能上亿,太多位的数字 ,会给我们阅读带来很大的障碍。 @@ -28,4 +28,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/c01/c01_32.rst b/source/c01/c01_32.rst index 96c6234..57aa83e 100644 --- a/source/c01/c01_32.rst +++ b/source/c01/c01_32.rst @@ -30,6 +30,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_01.md b/source/c02/c02_01.md index 07cc0b8..3ec7c4f 100644 --- a/source/c02/c02_01.md +++ b/source/c02/c02_01.md @@ -1,5 +1,5 @@ # 2.1 懒人必备技能:使用 “_” - + 对于 `_` ,大家对于他的印象都是用于 **占位符**,省得为一个不需要用到的变量,绞尽脑汁的想变量名。 @@ -62,4 +62,4 @@ world 知道这两个魔法方法的人,一看就明白了,这里不再解释啦。 - + diff --git a/source/c02/c02_01.rst b/source/c02/c02_01.rst index a854371..7e0a340 100644 --- a/source/c02/c02_01.rst +++ b/source/c02/c02_01.rst @@ -65,6 +65,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_02.md b/source/c02/c02_02.md index 39b1e70..3a5a087 100644 --- a/source/c02/c02_02.md +++ b/source/c02/c02_02.md @@ -1,5 +1,5 @@ # 2.2 最快查看包搜索路径的方式 - + 当你使用 import 导入一个包或模块时,Python 会去一些目录下查找,而这些目录是有优先级顺序的,正常人会使用 sys.path 查看。 @@ -58,4 +58,4 @@ ENABLE_USER_SITE: True 从输出你可以发现,这个列的路径会比 sys.path 更全,它包含了用户环境的目录。 - + diff --git a/source/c02/c02_02.rst b/source/c02/c02_02.rst index e09eced..73efe72 100644 --- a/source/c02/c02_02.rst +++ b/source/c02/c02_02.rst @@ -65,6 +65,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_03.md b/source/c02/c02_03.md index 2e40d77..9053e7c 100644 --- a/source/c02/c02_03.md +++ b/source/c02/c02_03.md @@ -1,5 +1,5 @@ # 2.3 使用 json.tool 来格式化 JSON - + 假设现在你需要查看你机器上的json文件,而这个文件没有经过任何的美化,阅读起来是非常困难的。 @@ -61,4 +61,4 @@ $ python -m json.tool demo.json - + diff --git a/source/c02/c02_03.rst b/source/c02/c02_03.rst index b15223a..09b4881 100644 --- a/source/c02/c02_03.rst +++ b/source/c02/c02_03.rst @@ -63,6 +63,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_04.md b/source/c02/c02_04.md index 0c74558..5bf7558 100644 --- a/source/c02/c02_04.md +++ b/source/c02/c02_04.md @@ -1,5 +1,5 @@ # 2.4 命令行式执行 Python 代码 - + 有时候你只是想验证一小段 Python 代码是否可用时,通常有两种方法 @@ -15,4 +15,4 @@ $ python -c "import hashlib;print(hashlib.md5('hello').hexdigest())" 只要加 -c 参数,就可以输入你的 Python 代码了。 - + diff --git a/source/c02/c02_04.rst b/source/c02/c02_04.rst index 6c06e0a..347b4bb 100644 --- a/source/c02/c02_04.rst +++ b/source/c02/c02_04.rst @@ -19,6 +19,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_05.md b/source/c02/c02_05.md index 36dba4a..594d25a 100644 --- a/source/c02/c02_05.md +++ b/source/c02/c02_05.md @@ -1,5 +1,5 @@ # 2.5 用调试模式执行脚本 - + 当你使用 pdb 进行脚本的调试时,你可能会先在目标代码处输入 `import pdb;pdb.set_trace()` 来设置断点。 @@ -14,4 +14,4 @@ $ python -m pdb demo.py - + diff --git a/source/c02/c02_05.rst b/source/c02/c02_05.rst index b84daff..f5d516e 100644 --- a/source/c02/c02_05.rst +++ b/source/c02/c02_05.rst @@ -17,6 +17,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_06.md b/source/c02/c02_06.md index 7486ca4..ddcbfd2 100644 --- a/source/c02/c02_06.md +++ b/source/c02/c02_06.md @@ -1,5 +1,5 @@ # 2.6 如何快速搭建 HTTP 服务器 - + 搭建FTP,或者是搭建网络文件系统,这些方法都能够实现Linux的目录共享。但是FTP和网络文件系统的功能都过于强大,因此它们都有一些不够方便的地方。比如你想快速共享Linux系统的某个目录给整个项目团队,还想在一分钟内做到,怎么办?很简单,使用Python中的SimpleHTTPServer。 @@ -13,8 +13,8 @@ python -m SimpleHTTPServer 8888 python3 -m http.server 8888 ``` - + SimpleHTTPServer有一个特性,如果待共享的目录下有index.html,那么index.html文件会被视为默认主页;如果不存在index.html文件,那么就会显示整个目录列表。 - + diff --git a/source/c02/c02_06.rst b/source/c02/c02_06.rst index 94ce3c7..119132b 100644 --- a/source/c02/c02_06.rst +++ b/source/c02/c02_06.rst @@ -23,7 +23,7 @@ SimpleHTTPServer有一个特性,如果待共享的目录下有index.html,那 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190511165716.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190511165716.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_07.md b/source/c02/c02_07.md index b5e06e7..d383e64 100644 --- a/source/c02/c02_07.md +++ b/source/c02/c02_07.md @@ -1,5 +1,5 @@ # 2.7 快速构建 HTML 帮助文档 - + 当你不知道一个内置模块如何使用时,会怎么做呢? @@ -20,8 +20,8 @@ pydoc server ready at http://localhost:5200/ 帮助文档的效果如下 - + ## - + diff --git a/source/c02/c02_07.rst b/source/c02/c02_07.rst index 0eaf0ec..be0ebbf 100644 --- a/source/c02/c02_07.rst +++ b/source/c02/c02_07.rst @@ -27,7 +27,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200718191249.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200718191249.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_08.md b/source/c02/c02_08.md index 3c145b2..990fa4e 100644 --- a/source/c02/c02_08.md +++ b/source/c02/c02_08.md @@ -1,5 +1,5 @@ # 2.8 最正确且优雅的装包方法 - + 当你使用 pip 来安装第三方的模块时,通常会使用这样的命令 @@ -29,4 +29,4 @@ $ python3.9 -m pip install requests - + diff --git a/source/c02/c02_08.rst b/source/c02/c02_08.rst index d98da9b..8c28761 100644 --- a/source/c02/c02_08.rst +++ b/source/c02/c02_08.rst @@ -34,6 +34,6 @@ Python3.9,那你安装包时就会很困惑,我到底把包安装在了哪 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_09.md b/source/c02/c02_09.md index 4b2c76f..4dfcc33 100644 --- a/source/c02/c02_09.md +++ b/source/c02/c02_09.md @@ -1,5 +1,5 @@ # 2.9 往 Python Shell 中传入参数 - + 往一个 Python 脚本传入参数,是一件非常简单的事情。 @@ -15,8 +15,8 @@ $ python demo.py arg1 arg2 经过我的摸索,终于找到了方法,具体方法如下: - + ## - + diff --git a/source/c02/c02_09.rst b/source/c02/c02_09.rst index ffe7697..5c1b05d 100644 --- a/source/c02/c02_09.rst +++ b/source/c02/c02_09.rst @@ -21,7 +21,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200801195158.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200801195158.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_10.md b/source/c02/c02_10.md index a5f822a..9296bd2 100644 --- a/source/c02/c02_10.md +++ b/source/c02/c02_10.md @@ -1,5 +1,5 @@ # 2.10 让脚本报错后立即进入调试模式 - + 当你在使用 `python xxx.py` 这样的方法,执行 Python 脚本时,若因为代码 bug 导致异常未捕获,那整个程序便会终止退出。 @@ -17,7 +17,7 @@ 具体演示如下: - + 需要注意的是:脚本执行完毕,有两种情况: @@ -26,8 +26,8 @@ 这两种都会进入 Python Shell,如果脚本并无异常,最终也会进入 Python Shell 模式,需要你手动退出 - + 如果希望脚本正确完成时自动退出,可以在脚本最后加上一行`__import__("os")._exit(0)` - + diff --git a/source/c02/c02_10.rst b/source/c02/c02_10.rst index c64afca..1360fb3 100644 --- a/source/c02/c02_10.rst +++ b/source/c02/c02_10.rst @@ -39,8 +39,8 @@ Shell 模式,方便你进行调试。 |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200801195950.png -.. |image2| image:: http://image.iswbm.com/20200801201110.png -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200801195950.png +.. |image2| image:: https://image.iswbm.com/20200801201110.png +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_11.md b/source/c02/c02_11.md index 89acb18..f645deb 100644 --- a/source/c02/c02_11.md +++ b/source/c02/c02_11.md @@ -1,19 +1,19 @@ # 2.11 极简模式执行 Python Shell - + 在终端输入 Python 就会进入 Python Shell 。 方便是挺方便,就是有点说不出的难受,谁能告诉我,为什么要多出这么大一段无关的内容。 - + 这有点像,你上爱某艺看视频吧,都要先看个 90 秒的广告。 如果你和我一样不喜欢这种 『牛皮癣』,那么可以加个 `-q` 参数,静默进入 Python Shell,就像下面这样子,开启了极简模式,舒服多了。 - + - + - + diff --git a/source/c02/c02_11.rst b/source/c02/c02_11.rst index f067548..5454661 100644 --- a/source/c02/c02_11.rst +++ b/source/c02/c02_11.rst @@ -20,9 +20,9 @@ Python Shell,就像下面这样子,开启了极简模式,舒服多了。 |image4| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200801202733.png -.. |image2| image:: http://image.iswbm.com/20200801203047.png -.. |image3| image:: http://image.iswbm.com/20200512125643.png -.. |image4| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200801202733.png +.. |image2| image:: https://image.iswbm.com/20200801203047.png +.. |image3| image:: https://image.iswbm.com/20200512125643.png +.. |image4| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_12.md b/source/c02/c02_12.md index 4a7e75d..98c78a6 100644 --- a/source/c02/c02_12.md +++ b/source/c02/c02_12.md @@ -1,5 +1,5 @@ # 2.12 在执行任意代码前自动念一段平安经 - + 最近的"平安经"可谓是引起了不小的风波啊。 @@ -13,7 +13,7 @@ 我要开始作妖了,噢不,是开始念经了。 - + 感谢佛祖保佑,Everything is ok,No bugs in the code. @@ -29,25 +29,25 @@ 我们需要新建一个用户环境目录,这个目录比较长,不需要你死记硬背,使用 site 模块的方法就可以获取,然后使用 `mkdir -p` 命令创建它。 - + 在这个目录下,新建一个 `usercustomize.py` 文件,注意名字必须是这个,换成其他的可就识别不到啦。 这个 `usercustomize.py` 的内容如下(明哥注:佛祖只保佑几个 Python 的主要应用方向,毕竟咱是 Python 攻城狮嘛...) - + 这个文件我放在了我的 github 上,点击[这里](https://github.com/iswbm/magic-python/blob/master/usercustomize.py)直达。 一切都完成后,无论你是使用 `python xxx.py` 执行脚本 - + 还是使用 `python` 进入 Python Shell ,都会先念一下平安经保平安。 - + 另外,有读者反馈这种设置会导致在Win10环境下 VSCode不能正常识别已安装的Python环境,并报出代码有导包错误等问题,因此请在你知道你自己在做什么,会千万什么后果,否则请在体验后还原你的环境。 - + diff --git a/source/c02/c02_12.rst b/source/c02/c02_12.rst index e9625ce..d5572e8 100644 --- a/source/c02/c02_12.rst +++ b/source/c02/c02_12.rst @@ -60,11 +60,11 @@ VSCode不能正常识别已安装的Python环境,并报出代码有导包错 |image6| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200801221705.png -.. |image2| image:: http://image.iswbm.com/20200801220819.png -.. |image3| image:: http://image.iswbm.com/20200801221413.png -.. |image4| image:: http://image.iswbm.com/20200801221705.png -.. |image5| image:: http://image.iswbm.com/20200801221457.png -.. |image6| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200801221705.png +.. |image2| image:: https://image.iswbm.com/20200801220819.png +.. |image3| image:: https://image.iswbm.com/20200801221413.png +.. |image4| image:: https://image.iswbm.com/20200801221705.png +.. |image5| image:: https://image.iswbm.com/20200801221457.png +.. |image6| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_13.md b/source/c02/c02_13.md index 7af79bb..ec3fc4d 100644 --- a/source/c02/c02_13.md +++ b/source/c02/c02_13.md @@ -1,5 +1,5 @@ # 2.13 启动 Python Shell 前自动执行某脚本 - + 前一节我们介绍了一种,只要运行解释器就会自动触发执行 Python 脚本的方法。 @@ -9,7 +9,7 @@ 先来看一下效果,在 `~/Library/Python/3.9/lib/python/site-packages` 目录下并没有 `usercustomize.py` 文件,但是在执行 python 进入 Python Shell 模式后,还是会打印平安经。 - + 这是如何做到的呢? @@ -17,7 +17,7 @@ 第一件事,在任意你喜欢的目录下,新建 一个Python 脚本,名字也随意,比如我叫 `startup.py`,内容还是和上面一样 - + 第二件事,设置一个环境变量 PYTHONSTARTUP,指向你的脚本路径 @@ -29,10 +29,10 @@ $ export PYTHONSTARTUP=/Users/MING/startup.py 但是这种方法只适用于 Python Shell ,并不适用于 Python 执行脚本的方法。 - + 如果要在脚本中实现这种效果,我目前想到最粗糙我笨拙的方法了 -- `手动加载执行` - + - + diff --git a/source/c02/c02_13.rst b/source/c02/c02_13.rst index 27e1053..8111aa9 100644 --- a/source/c02/c02_13.rst +++ b/source/c02/c02_13.rst @@ -43,10 +43,10 @@ Shell 模式后,还是会打印平安经。 |image5| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200801225652.png -.. |image2| image:: http://image.iswbm.com/20200801221413.png -.. |image3| image:: http://image.iswbm.com/20200801230230.png -.. |image4| image:: http://image.iswbm.com/20200801230503.png -.. |image5| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200801225652.png +.. |image2| image:: https://image.iswbm.com/20200801221413.png +.. |image3| image:: https://image.iswbm.com/20200801230230.png +.. |image4| image:: https://image.iswbm.com/20200801230503.png +.. |image5| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_14.md b/source/c02/c02_14.md index b18c71b..9f7a6fc 100644 --- a/source/c02/c02_14.md +++ b/source/c02/c02_14.md @@ -1,6 +1,6 @@ # 2.14 把模块当做脚本来执行 7 种方法及原理 - + ## 1. 用法举例 @@ -68,7 +68,7 @@ Python 给我们提供了一种方法,可以让我们将模块里的部分功 先看一下 `pip` 的源码目录,发现在其下有一个 `__main__.py` 的文件,难道这是 `-m` 的入口? - + 再看一下 `json.tool` 的源码文件,json 库下面却没有 `__main__.py` 的文件。 @@ -78,7 +78,7 @@ Python 给我们提供了一种方法,可以让我们将模块里的部分功 查看 tool 模块的源代码,有一个名为 main 的函数 - + 但它这不是关键,main 函数是在模块中直接被调用的。 @@ -133,7 +133,7 @@ hello,world 执行过程如下: - + 再来验证一下使用第二种方法。 @@ -182,4 +182,4 @@ $ echo '{"name": "MING"}' | python /usr/lib64/python2.7/json/tool.py - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_14.rst b/source/c02/c02_14.rst index 2481894..713af14 100644 --- a/source/c02/c02_14.rst +++ b/source/c02/c02_14.rst @@ -198,9 +198,9 @@ Python 的包导入机制会帮你做这些事情。 |image4| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200811155234.png -.. |image2| image:: http://image.iswbm.com/20200811154945.png -.. |image3| image:: http://image.iswbm.com/20200811184733.png -.. |image4| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200811155234.png +.. |image2| image:: https://image.iswbm.com/20200811154945.png +.. |image3| image:: https://image.iswbm.com/20200811184733.png +.. |image4| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_15.md b/source/c02/c02_15.md index 76ef3df..f565e5d 100644 --- a/source/c02/c02_15.md +++ b/source/c02/c02_15.md @@ -1,6 +1,6 @@ # 2.15 命令行式打开 idle 编辑脚本 - + 在你安装 Python 解释器的时候,会有一个选项,让你选择是否安装 idle,这是一个极简的 Python 编辑器,对于有点 python 编码的经验的同学,一般都已经安装了更加专业的代码编辑器,比如 pycharm,vscode 等,所以一般是不会去勾选它的。 @@ -18,12 +18,12 @@ python3 -m idlelib unshelve.py 使用的效果如下 - + 如果你不加文件的路径,默认会打开 idle 的 shell 模式 - + - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_15.rst b/source/c02/c02_15.rst index c32b255..56571e3 100644 --- a/source/c02/c02_15.rst +++ b/source/c02/c02_15.rst @@ -35,8 +35,8 @@ idle,这也是为什么 idle 是大多数人的第一个 Python 代码编辑 |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210504110446.png -.. |image2| image:: http://image.iswbm.com/20210504110758.png -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210504110446.png +.. |image2| image:: https://image.iswbm.com/20210504110758.png +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_16.md b/source/c02/c02_16.md index 023d43e..7220c0e 100644 --- a/source/c02/c02_16.md +++ b/source/c02/c02_16.md @@ -1,6 +1,6 @@ # 2.16 快速计算字符串 base64编码 - + ## 对字符串编码和解码 @@ -16,7 +16,7 @@ hello, world 效果如下 - + ## 对文件进行编码和解码 @@ -40,12 +40,12 @@ if __name__=='__main__': 效果如下 - + 如果你的文件是 py 脚本的话,可以直接执行它 - + - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_16.rst b/source/c02/c02_16.rst index a0b1060..a947077 100644 --- a/source/c02/c02_16.rst +++ b/source/c02/c02_16.rst @@ -51,9 +51,9 @@ |image4| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210504111702.png -.. |image2| image:: http://image.iswbm.com/20210504112153.png -.. |image3| image:: http://image.iswbm.com/20210504112257.png -.. |image4| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210504111702.png +.. |image2| image:: https://image.iswbm.com/20210504112153.png +.. |image3| image:: https://image.iswbm.com/20210504112257.png +.. |image4| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_17.md b/source/c02/c02_17.md index 94fcd4a..36ef0fd 100644 --- a/source/c02/c02_17.md +++ b/source/c02/c02_17.md @@ -1,6 +1,6 @@ # 2.17 快速找到指定文件的mime类型 - + 识别 html 文件 @@ -35,4 +35,4 @@ $ python -m mimetypes sample.py.gz type: text/x-python encoding: gzip # python文件,gzip压缩 ``` - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_17.rst b/source/c02/c02_17.rst index ce2bb56..224e5d6 100644 --- a/source/c02/c02_17.rst +++ b/source/c02/c02_17.rst @@ -38,6 +38,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_18.md b/source/c02/c02_18.md index b33efe4..e183bcf 100644 --- a/source/c02/c02_18.md +++ b/source/c02/c02_18.md @@ -1,6 +1,6 @@ # 2.18 快速查看 Python 的环境信息 - + 所有与 Python 相关的信息与配置,你都可以使用下面这条命令将其全部打印出来 @@ -15,6 +15,6 @@ $ python -m sysconfig - 包的搜索路径 - 以及各种环境变量 - + - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_18.rst b/source/c02/c02_18.rst index 003cb43..e8c5007 100644 --- a/source/c02/c02_18.rst +++ b/source/c02/c02_18.rst @@ -20,7 +20,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210504114516.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210504114516.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_19.md b/source/c02/c02_19.md index 93e941c..4752a8b 100644 --- a/source/c02/c02_19.md +++ b/source/c02/c02_19.md @@ -1,6 +1,6 @@ # 2.19 快速解压和压缩文件 - + ## tar 格式压缩包 @@ -83,4 +83,4 @@ drwxr-xr-x 3 MING staff 96 5 4 12:57 demo - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_19.rst b/source/c02/c02_19.rst index 448d3ee..1d2a3c3 100644 --- a/source/c02/c02_19.rst +++ b/source/c02/c02_19.rst @@ -88,6 +88,6 @@ zip 格式压缩包 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_20.md b/source/c02/c02_20.md index 88b7200..cfa8360 100644 --- a/source/c02/c02_20.md +++ b/source/c02/c02_20.md @@ -1,6 +1,6 @@ # 2.20 快速编辑 Python 脚本 - + pyc是一种二进制文件,是由py文件经过编译后,生成的文件,是一种byte code,py文件变成pyc文件后,加载的速度会有所提高。因此在一些场景下,可以预先编译成 pyc 文件,来提高加载速度。 @@ -24,4 +24,4 @@ demo - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_20.rst b/source/c02/c02_20.rst index 9fe874a..b1f3a75 100644 --- a/source/c02/c02_20.rst +++ b/source/c02/c02_20.rst @@ -27,6 +27,6 @@ pyc 文件,来提高加载速度。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_21.md b/source/c02/c02_21.md index ed5d676..f0fd9d9 100644 --- a/source/c02/c02_21.md +++ b/source/c02/c02_21.md @@ -1,6 +1,6 @@ # 2.21 使用自带的 telnet 端口检测工具 - + 若你想检测指定的机器上有没有开放某端口,但本机并没有安装 telnet 工具,不如尝试一下 python 自带的 telnetlib 库,亦可实现你的需求。 @@ -20,4 +20,4 @@ Telnet(192.168.56.200,22): recv b'' - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_21.rst b/source/c02/c02_21.rst index 4d5f6eb..1888c4d 100644 --- a/source/c02/c02_21.rst +++ b/source/c02/c02_21.rst @@ -22,6 +22,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_22.md b/source/c02/c02_22.md index 9955f5a..cdd99d5 100644 --- a/source/c02/c02_22.md +++ b/source/c02/c02_22.md @@ -1,10 +1,10 @@ # 2.22 快速将项目打包成应用程序 - + 假设我当前有一个 demo 项目,目录结构树及相关文件的的代码如下 - + 现在我使用如下命令,将该项目进行打包,其中 demo 是项目的文件夹名,`main:main` 中的第一个 main 指的 `main.py`,而第二个 main 指的是 `main` 函数 @@ -16,8 +16,8 @@ $ python3 -m zipapp demo -m "main:main" 具体演示过程如下 - + - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_22.rst b/source/c02/c02_22.rst index f129ad4..4e978b2 100644 --- a/source/c02/c02_22.rst +++ b/source/c02/c02_22.rst @@ -23,8 +23,8 @@ |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210504133550.png -.. |image2| image:: http://image.iswbm.com/20210504133711.png -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210504133550.png +.. |image2| image:: https://image.iswbm.com/20210504133711.png +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c02/c02_23.md b/source/c02/c02_23.md index b49369b..ac80dec 100644 --- a/source/c02/c02_23.md +++ b/source/c02/c02_23.md @@ -1,6 +1,6 @@ # 2.23 快速打印函数的调用栈 - + 在使用pdb时,手动打印调用栈 @@ -26,4 +26,4 @@ traceback.print_stack(file=sys.stdout) /usr/lib/python2.7/site-packages/eventlet/wsgi.py(481)handle_one_response() ``` - \ No newline at end of file + \ No newline at end of file diff --git a/source/c02/c02_23.rst b/source/c02/c02_23.rst index f716a41..d14ddfb 100644 --- a/source/c02/c02_23.rst +++ b/source/c02/c02_23.rst @@ -30,6 +30,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_01.md b/source/c03/c03_01.md index a79dff8..734cf86 100644 --- a/source/c03/c03_01.md +++ b/source/c03/c03_01.md @@ -1,5 +1,5 @@ # 3.1 八种连接列表的方式 - + ## 1、最直观的相加 @@ -180,4 +180,4 @@ sorted(itertools.chain(*iterables)) - + diff --git a/source/c03/c03_01.rst b/source/c03/c03_01.rst index f6efaf3..a6fed8f 100644 --- a/source/c03/c03_01.rst +++ b/source/c03/c03_01.rst @@ -192,6 +192,6 @@ heapq.merge,因为它采用堆排序,效率非常高。但若你不希望得 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_02.md b/source/c03/c03_02.md index ef80460..a39af52 100644 --- a/source/c03/c03_02.md +++ b/source/c03/c03_02.md @@ -1,5 +1,5 @@ # 3.2 合并字典的 7 种方法 - + ## 1、最简单的原地更新 @@ -198,4 +198,4 @@ Python 里对于生成列表、集合、字典,有一套非常 Pythonnic 的 看到这里,有没有涨姿势了,学了这么久的 Python ,没想到合并字典还有这么多的方法。本篇文章的主旨,并不在于让你全部掌握这 7 种合并字典的方法,实际在工作中,你只要选用一种最顺手的方式即可,但是在协同工作中,或者在阅读他人代码时,你不可避免地会碰到各式各样的写法,这时候你能下意识地知道这是在做合并字典的操作,那这篇文章就是有意义的。 - + diff --git a/source/c03/c03_02.rst b/source/c03/c03_02.rst index 65fe60b..973ecfb 100644 --- a/source/c03/c03_02.rst +++ b/source/c03/c03_02.rst @@ -209,6 +209,6 @@ Operator),用它可以很直观地合并多个字典。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_03.md b/source/c03/c03_03.md index e59b4fe..be88744 100644 --- a/source/c03/c03_03.md +++ b/source/c03/c03_03.md @@ -1,5 +1,5 @@ # 3.3 花式导包的八种方法 - + ## 1. 直接 import @@ -280,4 +280,4 @@ ok 好了,8 种方法都给大家介绍完毕,对于普通开发者来说,其实只要掌握 import 这种方法足够了,而对于那些想要自己开发框架的人来说,深入学习` __import__ `以及 importlib 是非常有必要的。 - + diff --git a/source/c03/c03_03.rst b/source/c03/c03_03.rst index 4330464..66c394f 100644 --- a/source/c03/c03_03.rst +++ b/source/c03/c03_03.rst @@ -304,6 +304,6 @@ importlib 是非常有必要的。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_04.md b/source/c03/c03_04.md index 721d58b..b3470e8 100644 --- a/source/c03/c03_04.md +++ b/source/c03/c03_04.md @@ -1,5 +1,5 @@ # 3.4 条件语句的七种写法 - + ## 第一种:原代码 @@ -145,4 +145,4 @@ else: 看到这里,有没有涨姿势了,学了这么久的 Python ,这么多骚操作,还真是活久见。。这六种写法里,我最推荐使用的是第一种,自己也经常在用,简洁直白,代码行还少。而其他的写法虽然能写,但是不会用,也不希望在我余生里碰到会在公共代码里用这些写法的同事。 - + diff --git a/source/c03/c03_04.rst b/source/c03/c03_04.rst index 82d83da..483564b 100644 --- a/source/c03/c03_04.rst +++ b/source/c03/c03_04.rst @@ -160,6 +160,6 @@ Python 功力。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_05.md b/source/c03/c03_05.md index 7794fae..61fc3a9 100644 --- a/source/c03/c03_05.md +++ b/source/c03/c03_05.md @@ -1,5 +1,5 @@ # 3.5 判断是否包含子串的七种方法 - + ## 1、使用 in 和 not in @@ -123,4 +123,4 @@ print(is_in("hello, python", "lol")) # False - + diff --git a/source/c03/c03_05.rst b/source/c03/c03_05.rst index a83e0d2..f5b330e 100644 --- a/source/c03/c03_05.rst +++ b/source/c03/c03_05.rst @@ -132,6 +132,6 @@ python 代码快。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_06.md b/source/c03/c03_06.md index d210a7a..424aa6b 100644 --- a/source/c03/c03_06.md +++ b/source/c03/c03_06.md @@ -1,5 +1,5 @@ # 3.6 海象运算符的三种用法 - + Python 版本发展非常快,如今最新的版本已经是 Pyhton 3.9,即便如此,有很多人甚至还停留在 3.6 或者 3.7,连 3.8 还没用上。 @@ -9,7 +9,7 @@ Python 版本发展非常快,如今最新的版本已经是 Pyhton 3.9,即 它的英文原名叫 `Assignment Expressions`,翻译过来也就是 `赋值表达式`,不过现在大家更普遍地称之为海象运算符,就是因为它长得真的太像海象了。 - + ## 第一个用法:if/else @@ -165,4 +165,4 @@ fat_bmis = [bmi for m in members if (bmi := get_bmi(m)) > 24] 海象运算符,是一个新奇的特性,有不少人觉得这样这样会破坏代码的可读性。确实在一个新鲜事物刚出来时是会这样,但我相信经过时间的沉淀后,越来越多的人使用它并享受它带来的便利时,这种争议也会慢慢消失在历史的长河中。 - + diff --git a/source/c03/c03_06.rst b/source/c03/c03_06.rst index a139415..b85d3cd 100644 --- a/source/c03/c03_06.rst +++ b/source/c03/c03_06.rst @@ -175,7 +175,7 @@ Golang,那这里要注意,Golang 中的 ``:=`` |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20200418122739417.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20200418122739417.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_07.md b/source/c03/c03_07.md index b750c7d..e146a3c 100644 --- a/source/c03/c03_07.md +++ b/source/c03/c03_07.md @@ -1,6 +1,6 @@ # 3.7 模块重载的五种方法 - + ## 环境准备 @@ -140,4 +140,4 @@ successful to be imported - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_07.rst b/source/c03/c03_07.rst index 10ce129..1321336 100644 --- a/source/c03/c03_07.rst +++ b/source/c03/c03_07.rst @@ -154,6 +154,6 @@ sys.modules 来重载模块这种方法是失效的。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_08.md b/source/c03/c03_08.md index f3f9f64..aed2e47 100644 --- a/source/c03/c03_08.md +++ b/source/c03/c03_08.md @@ -1,6 +1,6 @@ # 3.8 Python 转义的五种表示法 - + ## 1. 为什么要有转义? @@ -30,11 +30,11 @@ hello 把八进制的 13 转成 10 进制后是 11 - + 对照查看 ASCII 码表,11 对应的是一个垂直定位符号,这就能解释,为什么是阶梯状的输出字符串。 - + @@ -71,7 +71,7 @@ world 与此类似的表示法,还有如下这些 - + 于是,要实现 `hello` + 回车 + `world` ,就有了第三种方法 @@ -144,7 +144,7 @@ world 试想一下,假如你的同事,在打印日志时,使用这种 unicode 编码,然后你在定位问题的时候使用这个关键词去搜,却发现什么都搜不到?这就扑街了。 - + 虽然这种行为真的很 sb,但在某些人看来也许是非常牛逼的操作呢? @@ -307,4 +307,4 @@ u'hello\nworld' 如果本文对你有些许帮助,不如给明哥 **来个四连** ~ 比心 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_08.rst b/source/c03/c03_08.rst index 188d26a..821fdef 100644 --- a/source/c03/c03_08.rst +++ b/source/c03/c03_08.rst @@ -337,10 +337,10 @@ Unicode 编码其实还可以由 8 |image5| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20201125122441089.png -.. |image2| image:: http://image.iswbm.com/image-20201125122651086.png -.. |image3| image:: http://image.iswbm.com/image-20201125213925997.png -.. |image4| image:: http://image.iswbm.com/image-20201126090917123.png -.. |image5| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20201125122441089.png +.. |image2| image:: https://image.iswbm.com/image-20201125122651086.png +.. |image3| image:: https://image.iswbm.com/image-20201125213925997.png +.. |image4| image:: https://image.iswbm.com/image-20201126090917123.png +.. |image5| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_09.md b/source/c03/c03_09.md index 527a844..f1fb580 100644 --- a/source/c03/c03_09.md +++ b/source/c03/c03_09.md @@ -1,6 +1,6 @@ # 3.9 Python 装包的八种方法 - + ## 1. 使用 easy_install @@ -121,4 +121,4 @@ $ poetry add pytest --dev $ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python ``` - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_09.rst b/source/c03/c03_09.rst index 52d0162..a3550a0 100644 --- a/source/c03/c03_09.rst +++ b/source/c03/c03_09.rst @@ -143,6 +143,6 @@ Python 包在使用 ``setup.py`` |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_10.md b/source/c03/c03_10.md index 05539c4..2283b45 100644 --- a/source/c03/c03_10.md +++ b/source/c03/c03_10.md @@ -1,6 +1,6 @@ # 3.10 Python装饰器的六种写法 - + 装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象。 @@ -321,6 +321,6 @@ class User: 其实例化的过程,你可以参考我这里的调试过程,加以理解。 - + - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_10.rst b/source/c03/c03_10.rst index 703e627..f94ded5 100644 --- a/source/c03/c03_10.rst +++ b/source/c03/c03_10.rst @@ -342,7 +342,7 @@ Python工匠:使用装饰器的小技巧) |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190512113917.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190512113917.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_11.md b/source/c03/c03_11.md index e077467..f7d4374 100644 --- a/source/c03/c03_11.md +++ b/source/c03/c03_11.md @@ -1,6 +1,6 @@ # 3.11 Python 读取文件的六种方式 - + ## 第一种:使用 open @@ -86,4 +86,4 @@ b'hello, world' - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_11.rst b/source/c03/c03_11.rst index a5885ba..c8d8e28 100644 --- a/source/c03/c03_11.rst +++ b/source/c03/c03_11.rst @@ -96,6 +96,6 @@ os 模块也自带了 open 函数,直接操作的是底层的 I/O |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c03/c03_12.md b/source/c03/c03_12.md index ac144c9..ee4cf17 100644 --- a/source/c03/c03_12.md +++ b/source/c03/c03_12.md @@ -1,6 +1,6 @@ # 3.12 调用函数的九种方法 - + ## 方法一:直接调用函数运行 @@ -199,4 +199,4 @@ p = People() caller(p) ``` - \ No newline at end of file + \ No newline at end of file diff --git a/source/c03/c03_12.rst b/source/c03/c03_12.rst index 6b67cec..86e09da 100644 --- a/source/c03/c03_12.rst +++ b/source/c03/c03_12.rst @@ -223,6 +223,6 @@ open 来读取,最后使用 compile 函数编译运行。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c04/c04_01.md b/source/c04/c04_01.md index 7b42957..fd2abbb 100644 --- a/source/c04/c04_01.md +++ b/source/c04/c04_01.md @@ -1,5 +1,5 @@ # 4.1 精通上下文管理器 - + `with` 这个关键字,对于每一学习Python的人,都不会陌生。 @@ -184,7 +184,7 @@ with open_func('/Users/MING/mytest.txt') as file_in: 代码是这样的 - + 总结起来,使用上下文管理器有三个好处: @@ -192,4 +192,4 @@ with open_func('/Users/MING/mytest.txt') as file_in: 2. 提高代码的优雅度; 3. 提高代码的可读性; - + diff --git a/source/c04/c04_01.rst b/source/c04/c04_01.rst index 7f01caa..e119b83 100644 --- a/source/c04/c04_01.rst +++ b/source/c04/c04_01.rst @@ -209,7 +209,7 @@ open)的上下文管理器。 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190310172800.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190310172800.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c04/c04_02.md b/source/c04/c04_02.md index 37227a7..99d4089 100644 --- a/source/c04/c04_02.md +++ b/source/c04/c04_02.md @@ -1,5 +1,5 @@ # 4.2 深入理解描述符 - + 学习 Python 这么久了,说起 Python 的优雅之处,能让我脱口而出的, Descriptor(描述符)特性可以排得上号。 @@ -70,7 +70,7 @@ class Student: 这下程序稍微有点人工智能了,能够自己明辨是非了。 - + 程序是智能了,但在`__init__`里有太多的判断逻辑,很影响代码的可读性。巧的是,你刚好学过 Property 特性,可以很好地应用在这里。于是你将代码修改成如下,代码的可读性瞬间提升了不少 @@ -123,7 +123,7 @@ class Student: 程序还是一样的人工智能,非常好。 - + 你以为你写的代码,已经非常优秀,无懈可击了。 @@ -184,7 +184,7 @@ class Student: 实现的效果和前面的一样,可以对数据的合法性进行有效控制(字段类型、数值区间等) - + 以上,我举了下具体的实例,从最原始的编码风格到 Property ,最后引出描述符。由浅入深,一步一步带你感受到描述符的优雅之处。 @@ -427,7 +427,7 @@ math = TestProperty(fget=math) 由上面的注释,可以看出 `staticmethod` 其实就相当于一个描述符类,而`myfunc` 在此刻变成了一个描述符。关于 `staticmethod` 的实现,你可以参照下面这段我自己写的代码,加以理解。 - + 调用这个方法可以知道,每调用一次,它都会经过描述符类的 `__get__` 。 @@ -573,7 +573,7 @@ class Student: 引导程序逻辑进入描述符之后,不管你是获取属性,还是设置属性,都是直接作用于 instance 的。 - + 这段代码,你可以仔细和前面的对比一下。 @@ -584,4 +584,4 @@ class Student: 以上便是我对描述符的全部分享,希望能对你有所帮助。 - + diff --git a/source/c04/c04_02.rst b/source/c04/c04_02.rst index fb9aacb..504578e 100644 --- a/source/c04/c04_02.rst +++ b/source/c04/c04_02.rst @@ -641,11 +641,11 @@ instance 的。 |image6| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190425221322.png -.. |image2| image:: http://image.iswbm.com/20190425221322.png -.. |image3| image:: http://image.iswbm.com/20190425221233.png -.. |image4| image:: http://image.iswbm.com/20190519001930.png -.. |image5| image:: http://image.iswbm.com/20200812085823.png -.. |image6| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190425221322.png +.. |image2| image:: https://image.iswbm.com/20190425221322.png +.. |image3| image:: https://image.iswbm.com/20190425221233.png +.. |image4| image:: https://image.iswbm.com/20190519001930.png +.. |image5| image:: https://image.iswbm.com/20200812085823.png +.. |image6| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c04/c04_03.md b/source/c04/c04_03.md index fab3163..5faa968 100644 --- a/source/c04/c04_03.md +++ b/source/c04/c04_03.md @@ -1,6 +1,6 @@ # 4.3 神奇的元类编程 - + ## 1. 类是如何产生的 @@ -350,4 +350,4 @@ in User - [Python Cookbook - 元编程](http://python3-cookbook.readthedocs.io/zh_CN/latest/chapters/p09_meta_programming.html) - [深刻理解Python中的元类](http://blog.jobbole.com/21351/) - \ No newline at end of file + \ No newline at end of file diff --git a/source/c04/c04_03.rst b/source/c04/c04_03.rst index a22320a..2830294 100644 --- a/source/c04/c04_03.rst +++ b/source/c04/c04_03.rst @@ -371,6 +371,6 @@ ORM的一个类(User),就对应数据库中的一张表。id,name,email,passwo |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_01.md b/source/c05/c05_01.md index 711b5e8..049b941 100644 --- a/source/c05/c05_01.md +++ b/source/c05/c05_01.md @@ -1,5 +1,5 @@ # 5.1 嵌套上下文管理的另类写法 - + 当我们要写一个嵌套的上下文管理器时,可能会这样写 @@ -38,4 +38,4 @@ with test_context('aaa'), test_context('bbb'): - + diff --git a/source/c05/c05_01.rst b/source/c05/c05_01.rst index 6df44d3..53d4807 100644 --- a/source/c05/c05_01.rst +++ b/source/c05/c05_01.rst @@ -40,6 +40,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_02.md b/source/c05/c05_02.md index af862bf..e5767f4 100644 --- a/source/c05/c05_02.md +++ b/source/c05/c05_02.md @@ -1,5 +1,5 @@ # 5.2 将嵌套 for 循环写成单行 - + 我们经常会写如下这种嵌套的 for 循环代码 @@ -44,4 +44,4 @@ $ python demo.py - + diff --git a/source/c05/c05_02.rst b/source/c05/c05_02.rst index 827de8b..c272125 100644 --- a/source/c05/c05_02.rst +++ b/source/c05/c05_02.rst @@ -46,6 +46,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_03.md b/source/c05/c05_03.md index 488b8a0..083cbb1 100644 --- a/source/c05/c05_03.md +++ b/source/c05/c05_03.md @@ -1,5 +1,5 @@ # 5.3 单行实现 for 死循环如何写? - + 如果让你在不借助 while ,只使用 for 来写一个死循环? @@ -35,4 +35,4 @@ for i in iter(int, 1):pass 由于int() 永远返回0,永远返回不了1,所以这个 for 循环会没有终点。一直运行下去。 - + diff --git a/source/c05/c05_03.rst b/source/c05/c05_03.rst index 33b9c9f..03752c4 100644 --- a/source/c05/c05_03.rst +++ b/source/c05/c05_03.rst @@ -41,6 +41,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_04.md b/source/c05/c05_04.md index e97d916..4628e0e 100644 --- a/source/c05/c05_04.md +++ b/source/c05/c05_04.md @@ -1,5 +1,5 @@ # 5.4 如何关闭异常自动关联上下文? - + 当你在处理异常时,由于处理不当或者其他问题,再次抛出另一个异常时,往外抛出的异常也会携带原始的异常信息。 @@ -89,4 +89,4 @@ RuntimeError: Something bad happened - + diff --git a/source/c05/c05_04.rst b/source/c05/c05_04.rst index 55e8d76..2201084 100644 --- a/source/c05/c05_04.rst +++ b/source/c05/c05_04.rst @@ -90,6 +90,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_05.md b/source/c05/c05_05.md index d4d68be..186ce42 100644 --- a/source/c05/c05_05.md +++ b/source/c05/c05_05.md @@ -1,5 +1,5 @@ # 5.5 自带的缓存机制不用白不用 - + 缓存是一种将定量数据加以保存,以备迎合后续获取需求的处理方式,旨在加快数据获取的速度。 @@ -45,4 +45,4 @@ calculating: 2 + 3 - + diff --git a/source/c05/c05_05.rst b/source/c05/c05_05.rst index c501fac..d60f887 100644 --- a/source/c05/c05_05.rst +++ b/source/c05/c05_05.rst @@ -49,6 +49,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_06.md b/source/c05/c05_06.md index 288a2d5..b8fd4b9 100644 --- a/source/c05/c05_06.md +++ b/source/c05/c05_06.md @@ -1,5 +1,5 @@ # 5.6 如何流式读取数G超大文件 - + 使用 with...open... 可以从一个文件中读取数据,这是所有 Python 开发者都非常熟悉的操作。 @@ -60,4 +60,4 @@ def read_from_file(filename, block_size = 1024 * 8): - + diff --git a/source/c05/c05_06.rst b/source/c05/c05_06.rst index 7f862eb..6f86bd3 100644 --- a/source/c05/c05_06.rst +++ b/source/c05/c05_06.rst @@ -70,6 +70,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_07.md b/source/c05/c05_07.md index 4345821..7ff3cd9 100644 --- a/source/c05/c05_07.md +++ b/source/c05/c05_07.md @@ -1,5 +1,5 @@ # 5.7 实现类似 defer 的延迟调用 - + 在 Golang 中有一种延迟调用的机制,关键字是 defer,例如下面的示例 @@ -49,4 +49,4 @@ B - + diff --git a/source/c05/c05_07.rst b/source/c05/c05_07.rst index cfd3da8..ff416e0 100644 --- a/source/c05/c05_07.rst +++ b/source/c05/c05_07.rst @@ -52,6 +52,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_08.md b/source/c05/c05_08.md index 5a8a786..e7b91ac 100644 --- a/source/c05/c05_08.md +++ b/source/c05/c05_08.md @@ -1,5 +1,5 @@ # 5.8 如何快速计算函数运行时间 - + 计算一个函数的运行时间,你可能会这样子做 @@ -49,4 +49,4 @@ print(timeit.timeit(lambda :run_sleep(2), number=5)) - + diff --git a/source/c05/c05_08.rst b/source/c05/c05_08.rst index 5884c95..762d3fc 100644 --- a/source/c05/c05_08.rst +++ b/source/c05/c05_08.rst @@ -45,6 +45,6 @@ timeit 使用它,只用一行代码即可 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_09.md b/source/c05/c05_09.md index 7f56b4d..67ce265 100644 --- a/source/c05/c05_09.md +++ b/source/c05/c05_09.md @@ -1,5 +1,5 @@ # 5.9 重定向标准输出到日志 - + 假设你有一个脚本,会执行一些任务,比如说集群健康情况的检查。 @@ -38,4 +38,4 @@ with close_stdout(): - + diff --git a/source/c05/c05_09.rst b/source/c05/c05_09.rst index d333815..125897d 100644 --- a/source/c05/c05_09.rst +++ b/source/c05/c05_09.rst @@ -41,6 +41,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_10.md b/source/c05/c05_10.md index a357fca..1ee73d8 100644 --- a/source/c05/c05_10.md +++ b/source/c05/c05_10.md @@ -1,5 +1,5 @@ # 5.10 快速定位错误进入调试模式 - + 当你在写一个程序时,最初的程序一定遇到不少零零散散的错误,这时候就免不了调试一波。 @@ -15,14 +15,14 @@ 方法很简单,只需要你在执行脚本时,加入 `-i` 参考 - + 如果你的程序没有任何问题,加上 `-i` 后又会有什么不一样呢? 从下图可以看出,程序执行完成后会自动进入 console 交互模式。 - + - + diff --git a/source/c05/c05_10.rst b/source/c05/c05_10.rst index d068b86..f95cfa2 100644 --- a/source/c05/c05_10.rst +++ b/source/c05/c05_10.rst @@ -33,8 +33,8 @@ pdb 的代码。 |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200615235900.png -.. |image2| image:: http://image.iswbm.com/image-20200616000039009.png -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200615235900.png +.. |image2| image:: https://image.iswbm.com/image-20200616000039009.png +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_11.md b/source/c05/c05_11.md index a3031d8..3a62eda 100644 --- a/source/c05/c05_11.md +++ b/source/c05/c05_11.md @@ -1,5 +1,5 @@ # 5.11 在程序退出前执行代码的技巧 - + 使用 atexit 这个内置模块,可以很方便地注册退出函数。 @@ -7,7 +7,7 @@ 示例如下 - + 如果`clean()`函数有参数,那么你可以不用装饰器,而是直接调用`atexit.register(clean_1, 参数1, 参数2, 参数3='xxx')`。 @@ -19,4 +19,4 @@ - 如果发生了严重的 Python 内部错误,你注册的函数无法正常执行。 - 如果你手动调用了`os._exit()`,你注册的函数无法正常执行。 - + diff --git a/source/c05/c05_11.rst b/source/c05/c05_11.rst index 6cea8c1..7919cdb 100644 --- a/source/c05/c05_11.rst +++ b/source/c05/c05_11.rst @@ -24,7 +24,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200510112133.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200510112133.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_12.md b/source/c05/c05_12.md index e124322..029954e 100644 --- a/source/c05/c05_12.md +++ b/source/c05/c05_12.md @@ -1,5 +1,5 @@ # 5.12 逗号也有它的独特用法 - + 逗号,虽然是个很不起眼的符号,但在 Python 中也有他的用武之地。 @@ -44,4 +44,4 @@ for i in range(3): - + diff --git a/source/c05/c05_12.rst b/source/c05/c05_12.rst index 62502ac..8766d8f 100644 --- a/source/c05/c05_12.rst +++ b/source/c05/c05_12.rst @@ -46,6 +46,6 @@ print 的取消换行 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_13.md b/source/c05/c05_13.md index 72330ff..4041df9 100644 --- a/source/c05/c05_13.md +++ b/source/c05/c05_13.md @@ -1,5 +1,5 @@ # 5.13 如何在运行状态查看源代码? - + 查看函数的源代码,我们通常会使用 IDE 来完成。 @@ -38,4 +38,4 @@ def add(x, y): - + diff --git a/source/c05/c05_13.rst b/source/c05/c05_13.rst index 0362cff..ab125d8 100644 --- a/source/c05/c05_13.rst +++ b/source/c05/c05_13.rst @@ -38,6 +38,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_14.md b/source/c05/c05_14.md index a54285d..af480df 100644 --- a/source/c05/c05_14.md +++ b/source/c05/c05_14.md @@ -1,5 +1,5 @@ # 5.14 单分派泛函数如何写? - + 泛型,如果你尝过java,应该对他不陌生吧。但你可能不知道在 Python 中(3.4+ ),也可以实现 简单的泛型函数。 @@ -158,4 +158,4 @@ hello, world - + diff --git a/source/c05/c05_14.rst b/source/c05/c05_14.rst index 5cc5304..c8456b2 100644 --- a/source/c05/c05_14.rst +++ b/source/c05/c05_14.rst @@ -168,6 +168,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_15.md b/source/c05/c05_15.md index c724fe3..0530b23 100644 --- a/source/c05/c05_15.md +++ b/source/c05/c05_15.md @@ -1,5 +1,5 @@ # 5.15 让我爱不释手的用户环境 - + 当你在机器上并没有 root 权限时,如何安装 Python 的第三方包呢? @@ -40,4 +40,4 @@ logout - + diff --git a/source/c05/c05_15.rst b/source/c05/c05_15.rst index 4c97bc3..108e817 100644 --- a/source/c05/c05_15.rst +++ b/source/c05/c05_15.rst @@ -43,6 +43,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_16.md b/source/c05/c05_16.md index 5c3ca24..a9082bf 100644 --- a/source/c05/c05_16.md +++ b/source/c05/c05_16.md @@ -1,5 +1,5 @@ # 5.16 字符串的分割技巧 - + 当我们对字符串进行分割时,且分割符是 `\n`,有可能会出现这样一个窘境: @@ -68,4 +68,4 @@ b 因此在多个换行符的情况下,请务必使用 split 方法。 - + diff --git a/source/c05/c05_16.rst b/source/c05/c05_16.rst index ddfeee1..788aabb 100644 --- a/source/c05/c05_16.rst +++ b/source/c05/c05_16.rst @@ -77,6 +77,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_17.md b/source/c05/c05_17.md index 7dcfad8..f69addb 100644 --- a/source/c05/c05_17.md +++ b/source/c05/c05_17.md @@ -1,5 +1,5 @@ # 5.17 反转字符串/列表最优雅的方式 - + 反转序列并不难,但是如何做到最优雅呢? @@ -44,4 +44,4 @@ def my_reverse(str): [3, 2, 1] ``` - + diff --git a/source/c05/c05_17.rst b/source/c05/c05_17.rst index 508dcb9..7d9f2c1 100644 --- a/source/c05/c05_17.rst +++ b/source/c05/c05_17.rst @@ -48,6 +48,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_18.md b/source/c05/c05_18.md index ae3c685..827ef68 100644 --- a/source/c05/c05_18.md +++ b/source/c05/c05_18.md @@ -1,5 +1,5 @@ # 5.18 如何将 print 内容输出到文件 - + Python 3 中的 print 作为一个函数,由于可以接收更多的参数,所以功能变为更加强大。 @@ -16,4 +16,4 @@ hello, python - + diff --git a/source/c05/c05_18.rst b/source/c05/c05_18.rst index 7229359..ea13976 100644 --- a/source/c05/c05_18.rst +++ b/source/c05/c05_18.rst @@ -20,6 +20,6 @@ Python 3 中的 print |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_19.md b/source/c05/c05_19.md index f05e4ac..b998731 100644 --- a/source/c05/c05_19.md +++ b/source/c05/c05_19.md @@ -1,5 +1,5 @@ # 5.19 改变默认递归次数限制 - + 上面才提到递归,大家都知道使用递归是有风险的,递归深度过深容易导致堆栈的溢出。如果你这字符串太长啦,使用递归方式反转,就会出现问题。 @@ -21,4 +21,4 @@ - + diff --git a/source/c05/c05_19.rst b/source/c05/c05_19.rst index bba03f6..d142965 100644 --- a/source/c05/c05_19.rst +++ b/source/c05/c05_19.rst @@ -23,6 +23,6 @@ |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_20.md b/source/c05/c05_20.md index b38c990..43d76ef 100644 --- a/source/c05/c05_20.md +++ b/source/c05/c05_20.md @@ -1,5 +1,5 @@ # 5.20 让你晕头转向的 else 用法 - + if else 用法可以说是最基础的语法表达式之一,但是今天不是讲这个的。 @@ -62,4 +62,4 @@ test_try_else("ming") 总结一下,for else 和 try else 相同,只要代码正常走下去不被 break,不抛出异常,就可以走else。 - \ No newline at end of file + \ No newline at end of file diff --git a/source/c05/c05_20.rst b/source/c05/c05_20.rst index 91667ba..cbfc08f 100644 --- a/source/c05/c05_20.rst +++ b/source/c05/c05_20.rst @@ -69,6 +69,6 @@ break,不抛出异常,就可以走else。 |image1| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_21.md b/source/c05/c05_21.md index 8a652c4..547a3ea 100644 --- a/source/c05/c05_21.md +++ b/source/c05/c05_21.md @@ -1,6 +1,6 @@ # 5.21 字典访问不存在的key时不再报错 - + 当一个字典里没有某个 key 时,此时你访问他是会报 KeyError 的。 @@ -61,4 +61,4 @@ defaultdict(