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 @@ -![](http://image.iswbm.com/20200719231251.png) +![](https://image.iswbm.com/20200719231251.png)

- 微信 + 微信 GitHub stars GitHub issues Build Status - +

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://image.iswbm.com/20200607120940.png) +![](https://image.iswbm.com/20200607120940.png)

Build Status - +

## [项目主页](http://python.iswbm.com/) 在线阅读:[Python 编程时光](http://python.iswbm.com/) -![](http://image.iswbm.com/20200607130051.png) +![](https://image.iswbm.com/20200607130051.png) ## 文章结构 -![](http://image.iswbm.com/20200607131339.png) +![](https://image.iswbm.com/20200607131339.png) ''' readme_tooter = ''' --- -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) ''' 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("![](http://image.iswbm.com/20210523153308.png)", end="\n\n") + write("![](https://image.iswbm.com/20210523153308.png)", 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 默默无闻的省略号很好用 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在Python中,一切皆对象,省略号也不例外。 @@ -63,4 +63,4 @@ ok -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 来结束代码块 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 有不少编程语言,循环、判断代码块需要用 end 标明结束,这样一定程度上会使代码逻辑更加清晰一点。 @@ -34,4 +34,4 @@ print(my_abs(-10)) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 包 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 我们可以经常看到有 Python 包,居然可以以 zip 包进行发布,并且可以不用解压直接使用。 @@ -36,4 +36,4 @@ def add(x, y): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 反斜杠的倔强: 不写最后 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) `\` 在 Python 中的用法主要有两种 @@ -50,4 +50,4 @@ SyntaxError: EOL while scanning string literal -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 如何修改解释器提示符 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 这个当做今天的一个小彩蛋吧。应该算是比较冷门的,估计知道的人很少了吧。 @@ -33,4 +33,4 @@ Python编程时光>>>for i in range(2): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 简洁而优雅的链式比较 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 先给你看一个示例: @@ -26,4 +26,4 @@ False 这个用法叫做链式比较。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 的短路效应 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) and 和 or 是我们再熟悉不过的两个逻辑运算符,在 Python 也有它的妙用。 @@ -16,4 +16,4 @@ and 和 or 是我们再熟悉不过的两个逻辑运算符,在 Python 也有 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 连接多个列表最极客的方式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ```python >>> a = [1,2] @@ -10,4 +10,4 @@ [1, 2, 3, 4, 5, 6] ``` -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 字典居然是可以排序的? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Python 3.6 之前字典不可排序的思想,似乎已经根深蒂固。 @@ -23,4 +23,4 @@ -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 哪些情况下不需要续行符? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在写代码时,为了代码的可读性,代码的排版是尤为重要的。 @@ -47,4 +47,4 @@ talk is cheap,show me the code. -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 用户无感知的小整数池 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 为避免整数频繁申请和销毁内存空间,Python 定义了一个小整数池 [-5, 256] 这些整数对象是提前建立好的,不会被垃圾回收。 @@ -30,4 +30,4 @@ True 因为当你在同一行里,同时给两个变量赋同一值时,解释器知道这个对象已经生成,那么它就会引用到同一个对象。如果分成两行的话,解释器并不知道这个对象已经存在了,就会重新申请内存存放这个对象。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 机制 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 字符串类型作为Python中最常用的数据类型之一,Python解释器为了提高字符串使用的效率和使用性能,做了很多优化。 @@ -41,4 +41,4 @@ False -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 如果你足够细心,你会在你的机器上,有些包是安装在 **site-packages** 下,而有些包安装在 **dist-packages** 下。 @@ -21,4 +21,4 @@ Debian 这么设计的原因,是为了减少不同来源的 Python 之间产 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 的区别? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) arguments 和 parameter 的翻译都是参数,在中文场景下,二者混用基本没有问题,毕竟都叫参数嘛。 @@ -19,4 +19,4 @@ output_msg("error") -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 有什么用? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 我们经常会在别人的脚本或者项目的入口文件里看到第一行是下面这样 @@ -17,7 +17,7 @@ 稍微接触过 linux 的人都知道 `/usr/bin/python` 就是我们执行 `python` 进入console 模式里的 `python` -![](http://image.iswbm.com/20200331184021.png) +![](https://image.iswbm.com/20200331184021.png) 而当你在可执行文件头里使用 `#!` + `/usr/bin/python` ,意思就是说你得用哪个软件 (python)来执行这个文件。 @@ -25,19 +25,19 @@ 不加的话,你每次执行这个脚本时,都得这样: `python xx.py` , -![](http://image.iswbm.com/20200331185034.png) +![](https://image.iswbm.com/20200331185034.png) 有没有一种方式?可以省去每次都加 `python` 呢? 当然有,你可以文件头里加上`#!/usr/bin/python` ,那么当这个文件有可执行权限 时,只直接写这个脚本文件,就像下面这样。 -![](http://image.iswbm.com/20200331184755.png) +![](https://image.iswbm.com/20200331184755.png) 明白了这个后,再来看看 `!/usr/bin/env python` 这个 又是什么意思 ? 当我执行 `env python` 时,自动进入了 python console 的模式。 -![](http://image.iswbm.com/20200331185741.png) +![](https://image.iswbm.com/20200331185741.png) 这是为什么?和 直接执行 python 好像没什么区别呀 @@ -47,10 +47,10 @@ 具体演示过程,你可以看下面。 -![](http://image.iswbm.com/20200331190224.png) +![](https://image.iswbm.com/20200331190224.png) 那么对于这两者,我们应该使用哪个呢? 个人感觉应该优先使用 `#!/usr/bin/env python`,因为不是所有的机器的 python 解释器都是 `/usr/bin/python` 。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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() 与 {} 生成空字典有什么区别? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在初始化一个空字典时,有的人会写 dict(),而有的人会写成 {} @@ -52,4 +52,4 @@ $ python -m dis demo.py 可以发现使用 dict(),会多了个调用函数的过程,而这个过程会有进出栈的操作,相对更加耗时。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 用法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) import 是 Python 导包的方式。 @@ -49,6 +49,6 @@ Namespaces are one honking great idea -- let's do more of those! ``` 就会自动打开一个网页。 -![](http://image.iswbm.com/20190511165735.png) +![](https://image.iswbm.com/20190511165735.png) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 正负得负,负负得正 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 从初中开始,我们就开始接触了`负数` ,并且都知道了`负负得正` 的思想。 @@ -20,4 +20,4 @@ Python 作为一门高级语言,它的编写符合人类的思维逻辑,包 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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不一定都是函数的终点 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 众所周知,try…finally… 的用法是:不管try里面是正常执行还是有报异常,最终都能保证finally能够执行。 @@ -46,4 +46,4 @@ finally 那结论就出来了,如果 finally 里有显式的 return,那么这个 return 会直接覆盖 try 里的 return,而如果 finally 里没有 显式的 return,那么 try 里的 return 仍然有效。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 字符串里的缝隙是什么? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在Python中求一个字符串里,某子字符(串)出现的次数。 @@ -29,7 +29,7 @@ 因此 对于 `aabb` 这个字符串在 Python 来看应该是这样的 -![](http://image.iswbm.com/20200509172331.png) +![](https://image.iswbm.com/20200509172331.png) 理解了这个“**缝隙**” 的概念后,以下这些就好理解了。 @@ -46,4 +46,4 @@ True -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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(“”) -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 可能会有不少人,觉得只有 Python 3 才可以使用 print(),而 Python 2 只能使用`print ""`。 @@ -28,4 +28,4 @@ print ("hello") 虽然 在 Python 2.6+ 可以和 Python3.x+ 一样,像函数一样去调用 print ,但是这仅用于两个 python 版本之间的代码兼容,并不是说在 python2.6+下使用 print() 后,就成了函数。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 字母也玩起了障眼法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 以下我分别在 Python2.7 和 Python 3.7 的 console 模式下,运行了如下代码。 @@ -23,13 +23,13 @@ SyntaxError: invalid syntax 什么?没有截图你不信? -![](http://image.iswbm.com/20200509122954.png) +![](https://image.iswbm.com/20200509122954.png) 如果你在自己的电脑上尝试一下,结果可能是这样的 -![](http://image.iswbm.com/20200509123107.png) +![](https://image.iswbm.com/20200509123107.png) @@ -54,4 +54,4 @@ False 细思恐极,在这里可千万不要得罪同事们,万一离职的时候,对方把你项目里的 `e` 全局替换成 `e`,到时候你就哭去吧,肉眼根本看不出来嘛。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 数值与字符串的比较 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Python2 中,数字可以与字符串直接比较。结果是数值永远比字符串小。 @@ -19,4 +19,4 @@ TypeError: '<' not supported between instances of 'int' and 'str' -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 时有时无的切片异常 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 这是个简单例子,alist 只有5 个元素,当你取第 6 个元素时,会抛出索引异常。这与我们的认知一致。 @@ -24,4 +24,4 @@ IndexError: list index out of range -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 迷一样的字符串 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 示例一 @@ -56,4 +56,4 @@ True -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 等价吗? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在大多数情况下,这个等式是成立的。 @@ -32,4 +32,4 @@ Counter({'a': 3, 'b': 2}) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 += 不等同于=+ -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 对列表 进行`+=` 操作相当于 extend,而使用 `=+` 操作是新增了一个列表。 @@ -28,4 +28,4 @@ -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 循环中的局部变量泄露 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在Python 2中 x 的值在一个循环执行之后被改变了。 @@ -25,4 +25,4 @@ -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 局部/全局变量傻傻分不清 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在开始讲之前,你可以试着运行一下下面这小段代码。 @@ -48,4 +48,4 @@ $ python demo.py -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 和 上下文管理器哪个优先级高? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 众所周知,在循环体中(无论是 for 还是 while),continue 会用来跳入下一个循环,而 break 则用来跳出某个循环体。 @@ -49,4 +49,4 @@ end: a = 2 1. continue 与 break 一样,如果先遇到上下文管理器会先进行资源的释放 2. 上面只举例了 while 循环体,而 for 循环也是同样的。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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一样分割字符串? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 若你使用过 Shell 中的 awk 工具,会发现用它来分割字符串是非常方便的。特别是多个连续空格会被当做一个处理。 @@ -61,7 +61,7 @@ split函数不加参数,就能达到 awk 的效果 查看了注释,原来是这个函数会适配 None 的情况,当第一个参数是None的时候,返回第二个参数(可迭代对象)中非空的值,非常方便。 -![](http://image.iswbm.com/20200821173708.png) +![](https://image.iswbm.com/20200821173708.png) 换用函数的写法,可以这样 @@ -78,4 +78,4 @@ split函数不加参数,就能达到 awk 的效果 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 如何让大数变得更易于阅读? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当一个数非常大时,可能过百万,也可能上亿,太多位的数字 ,会给我们阅读带来很大的障碍。 @@ -28,4 +28,4 @@ -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 懒人必备技能:使用 “_” -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 对于 `_` ,大家对于他的印象都是用于 **占位符**,省得为一个不需要用到的变量,绞尽脑汁的想变量名。 @@ -62,4 +62,4 @@ world 知道这两个魔法方法的人,一看就明白了,这里不再解释啦。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 最快查看包搜索路径的方式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你使用 import 导入一个包或模块时,Python 会去一些目录下查找,而这些目录是有优先级顺序的,正常人会使用 sys.path 查看。 @@ -58,4 +58,4 @@ ENABLE_USER_SITE: True 从输出你可以发现,这个列的路径会比 sys.path 更全,它包含了用户环境的目录。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 假设现在你需要查看你机器上的json文件,而这个文件没有经过任何的美化,阅读起来是非常困难的。 @@ -61,4 +61,4 @@ $ python -m json.tool demo.json -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 代码 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 有时候你只是想验证一小段 Python 代码是否可用时,通常有两种方法 @@ -15,4 +15,4 @@ $ python -c "import hashlib;print(hashlib.md5('hello').hexdigest())" 只要加 -c 参数,就可以输入你的 Python 代码了。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 用调试模式执行脚本 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你使用 pdb 进行脚本的调试时,你可能会先在目标代码处输入 `import pdb;pdb.set_trace()` 来设置断点。 @@ -14,4 +14,4 @@ $ python -m pdb demo.py -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 服务器 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 搭建FTP,或者是搭建网络文件系统,这些方法都能够实现Linux的目录共享。但是FTP和网络文件系统的功能都过于强大,因此它们都有一些不够方便的地方。比如你想快速共享Linux系统的某个目录给整个项目团队,还想在一分钟内做到,怎么办?很简单,使用Python中的SimpleHTTPServer。 @@ -13,8 +13,8 @@ python -m SimpleHTTPServer 8888 python3 -m http.server 8888 ``` -![](http://image.iswbm.com/20190511165716.png) +![](https://image.iswbm.com/20190511165716.png) SimpleHTTPServer有一个特性,如果待共享的目录下有index.html,那么index.html文件会被视为默认主页;如果不存在index.html文件,那么就会显示整个目录列表。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 帮助文档 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你不知道一个内置模块如何使用时,会怎么做呢? @@ -20,8 +20,8 @@ pydoc server ready at http://localhost:5200/ 帮助文档的效果如下 -![](http://image.iswbm.com/20200718191249.png) +![](https://image.iswbm.com/20200718191249.png) ## -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 最正确且优雅的装包方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你使用 pip 来安装第三方的模块时,通常会使用这样的命令 @@ -29,4 +29,4 @@ $ python3.9 -m pip install requests -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 中传入参数 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 往一个 Python 脚本传入参数,是一件非常简单的事情。 @@ -15,8 +15,8 @@ $ python demo.py arg1 arg2 经过我的摸索,终于找到了方法,具体方法如下: -![](http://image.iswbm.com/20200801195158.png) +![](https://image.iswbm.com/20200801195158.png) ## -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 让脚本报错后立即进入调试模式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你在使用 `python xxx.py` 这样的方法,执行 Python 脚本时,若因为代码 bug 导致异常未捕获,那整个程序便会终止退出。 @@ -17,7 +17,7 @@ 具体演示如下: -![](http://image.iswbm.com/20200801195950.png) +![](https://image.iswbm.com/20200801195950.png) 需要注意的是:脚本执行完毕,有两种情况: @@ -26,8 +26,8 @@ 这两种都会进入 Python Shell,如果脚本并无异常,最终也会进入 Python Shell 模式,需要你手动退出 -![](http://image.iswbm.com/20200801201110.png) +![](https://image.iswbm.com/20200801201110.png) 如果希望脚本正确完成时自动退出,可以在脚本最后加上一行`__import__("os")._exit(0)` -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在终端输入 Python 就会进入 Python Shell 。 方便是挺方便,就是有点说不出的难受,谁能告诉我,为什么要多出这么大一段无关的内容。 -![](http://image.iswbm.com/20200801202733.png) +![](https://image.iswbm.com/20200801202733.png) 这有点像,你上爱某艺看视频吧,都要先看个 90 秒的广告。 如果你和我一样不喜欢这种 『牛皮癣』,那么可以加个 `-q` 参数,静默进入 Python Shell,就像下面这样子,开启了极简模式,舒服多了。 -![](http://image.iswbm.com/20200801203047.png) +![](https://image.iswbm.com/20200801203047.png) -![](http://image.iswbm.com/20200512125643.png) +![](https://image.iswbm.com/20200512125643.png) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 在执行任意代码前自动念一段平安经 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 最近的"平安经"可谓是引起了不小的风波啊。 @@ -13,7 +13,7 @@ 我要开始作妖了,噢不,是开始念经了。 -![](http://image.iswbm.com/20200801221705.png) +![](https://image.iswbm.com/20200801221705.png) 感谢佛祖保佑,Everything is ok,No bugs in the code. @@ -29,25 +29,25 @@ 我们需要新建一个用户环境目录,这个目录比较长,不需要你死记硬背,使用 site 模块的方法就可以获取,然后使用 `mkdir -p` 命令创建它。 -![](http://image.iswbm.com/20200801220819.png) +![](https://image.iswbm.com/20200801220819.png) 在这个目录下,新建一个 `usercustomize.py` 文件,注意名字必须是这个,换成其他的可就识别不到啦。 这个 `usercustomize.py` 的内容如下(明哥注:佛祖只保佑几个 Python 的主要应用方向,毕竟咱是 Python 攻城狮嘛...) -![](http://image.iswbm.com/20200801221413.png) +![](https://image.iswbm.com/20200801221413.png) 这个文件我放在了我的 github 上,点击[这里](https://github.com/iswbm/magic-python/blob/master/usercustomize.py)直达。 一切都完成后,无论你是使用 `python xxx.py` 执行脚本 -![](http://image.iswbm.com/20200801221705.png) +![](https://image.iswbm.com/20200801221705.png) 还是使用 `python` 进入 Python Shell ,都会先念一下平安经保平安。 -![](http://image.iswbm.com/20200801221457.png) +![](https://image.iswbm.com/20200801221457.png) 另外,有读者反馈这种设置会导致在Win10环境下 VSCode不能正常识别已安装的Python环境,并报出代码有导包错误等问题,因此请在你知道你自己在做什么,会千万什么后果,否则请在体验后还原你的环境。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 前自动执行某脚本 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 前一节我们介绍了一种,只要运行解释器就会自动触发执行 Python 脚本的方法。 @@ -9,7 +9,7 @@ 先来看一下效果,在 `~/Library/Python/3.9/lib/python/site-packages` 目录下并没有 `usercustomize.py` 文件,但是在执行 python 进入 Python Shell 模式后,还是会打印平安经。 -![](http://image.iswbm.com/20200801225652.png) +![](https://image.iswbm.com/20200801225652.png) 这是如何做到的呢? @@ -17,7 +17,7 @@ 第一件事,在任意你喜欢的目录下,新建 一个Python 脚本,名字也随意,比如我叫 `startup.py`,内容还是和上面一样 -![](http://image.iswbm.com/20200801221413.png) +![](https://image.iswbm.com/20200801221413.png) 第二件事,设置一个环境变量 PYTHONSTARTUP,指向你的脚本路径 @@ -29,10 +29,10 @@ $ export PYTHONSTARTUP=/Users/MING/startup.py 但是这种方法只适用于 Python Shell ,并不适用于 Python 执行脚本的方法。 -![](http://image.iswbm.com/20200801230230.png) +![](https://image.iswbm.com/20200801230230.png) 如果要在脚本中实现这种效果,我目前想到最粗糙我笨拙的方法了 -- `手动加载执行` -![](http://image.iswbm.com/20200801230503.png) +![](https://image.iswbm.com/20200801230503.png) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 种方法及原理 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1. 用法举例 @@ -68,7 +68,7 @@ Python 给我们提供了一种方法,可以让我们将模块里的部分功 先看一下 `pip` 的源码目录,发现在其下有一个 `__main__.py` 的文件,难道这是 `-m` 的入口? -![](http://image.iswbm.com/20200811155234.png) +![](https://image.iswbm.com/20200811155234.png) 再看一下 `json.tool` 的源码文件,json 库下面却没有 `__main__.py` 的文件。 @@ -78,7 +78,7 @@ Python 给我们提供了一种方法,可以让我们将模块里的部分功 查看 tool 模块的源代码,有一个名为 main 的函数 -![](http://image.iswbm.com/20200811154945.png) +![](https://image.iswbm.com/20200811154945.png) 但它这不是关键,main 函数是在模块中直接被调用的。 @@ -133,7 +133,7 @@ hello,world 执行过程如下: -![](http://image.iswbm.com/20200811184733.png) +![](https://image.iswbm.com/20200811184733.png) 再来验证一下使用第二种方法。 @@ -182,4 +182,4 @@ $ echo '{"name": "MING"}' | python /usr/lib64/python2.7/json/tool.py -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 编辑脚本 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在你安装 Python 解释器的时候,会有一个选项,让你选择是否安装 idle,这是一个极简的 Python 编辑器,对于有点 python 编码的经验的同学,一般都已经安装了更加专业的代码编辑器,比如 pycharm,vscode 等,所以一般是不会去勾选它的。 @@ -18,12 +18,12 @@ python3 -m idlelib unshelve.py 使用的效果如下 -![](http://image.iswbm.com/20210504110446.png) +![](https://image.iswbm.com/20210504110446.png) 如果你不加文件的路径,默认会打开 idle 的 shell 模式 -![](http://image.iswbm.com/20210504110758.png) +![](https://image.iswbm.com/20210504110758.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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编码 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 对字符串编码和解码 @@ -16,7 +16,7 @@ hello, world 效果如下 -![](http://image.iswbm.com/20210504111702.png) +![](https://image.iswbm.com/20210504111702.png) ## 对文件进行编码和解码 @@ -40,12 +40,12 @@ if __name__=='__main__': 效果如下 -![](http://image.iswbm.com/20210504112153.png) +![](https://image.iswbm.com/20210504112153.png) 如果你的文件是 py 脚本的话,可以直接执行它 -![](http://image.iswbm.com/20210504112257.png) +![](https://image.iswbm.com/20210504112257.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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类型 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 识别 html 文件 @@ -35,4 +35,4 @@ $ python -m mimetypes sample.py.gz type: text/x-python encoding: gzip # python文件,gzip压缩 ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 的环境信息 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 所有与 Python 相关的信息与配置,你都可以使用下面这条命令将其全部打印出来 @@ -15,6 +15,6 @@ $ python -m sysconfig - 包的搜索路径 - 以及各种环境变量 -![](http://image.iswbm.com/20210504114516.png) +![](https://image.iswbm.com/20210504114516.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 快速解压和压缩文件 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## tar 格式压缩包 @@ -83,4 +83,4 @@ drwxr-xr-x 3 MING staff 96 5 4 12:57 demo -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 脚本 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) pyc是一种二进制文件,是由py文件经过编译后,生成的文件,是一种byte code,py文件变成pyc文件后,加载的速度会有所提高。因此在一些场景下,可以预先编译成 pyc 文件,来提高加载速度。 @@ -24,4 +24,4 @@ demo -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 端口检测工具 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 若你想检测指定的机器上有没有开放某端口,但本机并没有安装 telnet 工具,不如尝试一下 python 自带的 telnetlib 库,亦可实现你的需求。 @@ -20,4 +20,4 @@ Telnet(192.168.56.200,22): recv b'' -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 快速将项目打包成应用程序 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 假设我当前有一个 demo 项目,目录结构树及相关文件的的代码如下 -![](http://image.iswbm.com/20210504133550.png) +![](https://image.iswbm.com/20210504133550.png) 现在我使用如下命令,将该项目进行打包,其中 demo 是项目的文件夹名,`main:main` 中的第一个 main 指的 `main.py`,而第二个 main 指的是 `main` 函数 @@ -16,8 +16,8 @@ $ python3 -m zipapp demo -m "main:main" 具体演示过程如下 -![](http://image.iswbm.com/20210504133711.png) +![](https://image.iswbm.com/20210504133711.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 快速打印函数的调用栈 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在使用pdb时,手动打印调用栈 @@ -26,4 +26,4 @@ traceback.print_stack(file=sys.stdout) /usr/lib/python2.7/site-packages/eventlet/wsgi.py(481)handle_one_response() ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 八种连接列表的方式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1、最直观的相加 @@ -180,4 +180,4 @@ sorted(itertools.chain(*iterables)) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1、最简单的原地更新 @@ -198,4 +198,4 @@ Python 里对于生成列表、集合、字典,有一套非常 Pythonnic 的 看到这里,有没有涨姿势了,学了这么久的 Python ,没想到合并字典还有这么多的方法。本篇文章的主旨,并不在于让你全部掌握这 7 种合并字典的方法,实际在工作中,你只要选用一种最顺手的方式即可,但是在协同工作中,或者在阅读他人代码时,你不可避免地会碰到各式各样的写法,这时候你能下意识地知道这是在做合并字典的操作,那这篇文章就是有意义的。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 花式导包的八种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1. 直接 import @@ -280,4 +280,4 @@ ok 好了,8 种方法都给大家介绍完毕,对于普通开发者来说,其实只要掌握 import 这种方法足够了,而对于那些想要自己开发框架的人来说,深入学习` __import__ `以及 importlib 是非常有必要的。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 条件语句的七种写法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 第一种:原代码 @@ -145,4 +145,4 @@ else: 看到这里,有没有涨姿势了,学了这么久的 Python ,这么多骚操作,还真是活久见。。这六种写法里,我最推荐使用的是第一种,自己也经常在用,简洁直白,代码行还少。而其他的写法虽然能写,但是不会用,也不希望在我余生里碰到会在公共代码里用这些写法的同事。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 判断是否包含子串的七种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1、使用 in 和 not in @@ -123,4 +123,4 @@ print(is_in("hello, python", "lol")) # False -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 海象运算符的三种用法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) Python 版本发展非常快,如今最新的版本已经是 Pyhton 3.9,即便如此,有很多人甚至还停留在 3.6 或者 3.7,连 3.8 还没用上。 @@ -9,7 +9,7 @@ Python 版本发展非常快,如今最新的版本已经是 Pyhton 3.9,即 它的英文原名叫 `Assignment Expressions`,翻译过来也就是 `赋值表达式`,不过现在大家更普遍地称之为海象运算符,就是因为它长得真的太像海象了。 -![](http://image.iswbm.com/image-20200418122739417.png) +![](https://image.iswbm.com/image-20200418122739417.png) ## 第一个用法:if/else @@ -165,4 +165,4 @@ fat_bmis = [bmi for m in members if (bmi := get_bmi(m)) > 24] 海象运算符,是一个新奇的特性,有不少人觉得这样这样会破坏代码的可读性。确实在一个新鲜事物刚出来时是会这样,但我相信经过时间的沉淀后,越来越多的人使用它并享受它带来的便利时,这种争议也会慢慢消失在历史的长河中。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 模块重载的五种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 环境准备 @@ -140,4 +140,4 @@ successful to be imported -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 转义的五种表示法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1. 为什么要有转义? @@ -30,11 +30,11 @@ hello 把八进制的 13 转成 10 进制后是 11 -![](http://image.iswbm.com/image-20201125122441089.png) +![](https://image.iswbm.com/image-20201125122441089.png) 对照查看 ASCII 码表,11 对应的是一个垂直定位符号,这就能解释,为什么是阶梯状的输出字符串。 -![](http://image.iswbm.com/image-20201125122651086.png) +![](https://image.iswbm.com/image-20201125122651086.png) @@ -71,7 +71,7 @@ world 与此类似的表示法,还有如下这些 -![](http://image.iswbm.com/image-20201125213925997.png) +![](https://image.iswbm.com/image-20201125213925997.png) 于是,要实现 `hello` + 回车 + `world` ,就有了第三种方法 @@ -144,7 +144,7 @@ world 试想一下,假如你的同事,在打印日志时,使用这种 unicode 编码,然后你在定位问题的时候使用这个关键词去搜,却发现什么都搜不到?这就扑街了。 -![](http://image.iswbm.com/image-20201126090917123.png) +![](https://image.iswbm.com/image-20201126090917123.png) 虽然这种行为真的很 sb,但在某些人看来也许是非常牛逼的操作呢? @@ -307,4 +307,4 @@ u'hello\nworld' 如果本文对你有些许帮助,不如给明哥 **来个四连** ~ 比心 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 装包的八种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 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 ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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装饰器的六种写法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象。 @@ -321,6 +321,6 @@ class User: 其实例化的过程,你可以参考我这里的调试过程,加以理解。 -![](http://image.iswbm.com/20190512113917.png) +![](https://image.iswbm.com/20190512113917.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 读取文件的六种方式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 第一种:使用 open @@ -86,4 +86,4 @@ b'hello, world' -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 调用函数的九种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 方法一:直接调用函数运行 @@ -199,4 +199,4 @@ p = People() caller(p) ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 精通上下文管理器 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) `with` 这个关键字,对于每一学习Python的人,都不会陌生。 @@ -184,7 +184,7 @@ with open_func('/Users/MING/mytest.txt') as file_in: 代码是这样的 -![](http://image.iswbm.com/20190310172800.png) +![](https://image.iswbm.com/20190310172800.png) 总结起来,使用上下文管理器有三个好处: @@ -192,4 +192,4 @@ with open_func('/Users/MING/mytest.txt') as file_in: 2. 提高代码的优雅度; 3. 提高代码的可读性; -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 深入理解描述符 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 学习 Python 这么久了,说起 Python 的优雅之处,能让我脱口而出的, Descriptor(描述符)特性可以排得上号。 @@ -70,7 +70,7 @@ class Student: 这下程序稍微有点人工智能了,能够自己明辨是非了。 -![](http://image.iswbm.com/20190425221322.png) +![](https://image.iswbm.com/20190425221322.png) 程序是智能了,但在`__init__`里有太多的判断逻辑,很影响代码的可读性。巧的是,你刚好学过 Property 特性,可以很好地应用在这里。于是你将代码修改成如下,代码的可读性瞬间提升了不少 @@ -123,7 +123,7 @@ class Student: 程序还是一样的人工智能,非常好。 -![](http://image.iswbm.com/20190425221322.png) +![](https://image.iswbm.com/20190425221322.png) 你以为你写的代码,已经非常优秀,无懈可击了。 @@ -184,7 +184,7 @@ class Student: 实现的效果和前面的一样,可以对数据的合法性进行有效控制(字段类型、数值区间等) -![](http://image.iswbm.com/20190425221233.png) +![](https://image.iswbm.com/20190425221233.png) 以上,我举了下具体的实例,从最原始的编码风格到 Property ,最后引出描述符。由浅入深,一步一步带你感受到描述符的优雅之处。 @@ -427,7 +427,7 @@ math = TestProperty(fget=math) 由上面的注释,可以看出 `staticmethod` 其实就相当于一个描述符类,而`myfunc` 在此刻变成了一个描述符。关于 `staticmethod` 的实现,你可以参照下面这段我自己写的代码,加以理解。 -![](http://image.iswbm.com/20190519001930.png) +![](https://image.iswbm.com/20190519001930.png) 调用这个方法可以知道,每调用一次,它都会经过描述符类的 `__get__` 。 @@ -573,7 +573,7 @@ class Student: 引导程序逻辑进入描述符之后,不管你是获取属性,还是设置属性,都是直接作用于 instance 的。 -![](http://image.iswbm.com/20200812085823.png) +![](https://image.iswbm.com/20200812085823.png) 这段代码,你可以仔细和前面的对比一下。 @@ -584,4 +584,4 @@ class Student: 以上便是我对描述符的全部分享,希望能对你有所帮助。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 神奇的元类编程 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 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/) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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 嵌套上下文管理的另类写法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当我们要写一个嵌套的上下文管理器时,可能会这样写 @@ -38,4 +38,4 @@ with test_context('aaa'), test_context('bbb'): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 循环写成单行 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 我们经常会写如下这种嵌套的 for 循环代码 @@ -44,4 +44,4 @@ $ python demo.py -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 死循环如何写? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 如果让你在不借助 while ,只使用 for 来写一个死循环? @@ -35,4 +35,4 @@ for i in iter(int, 1):pass 由于int() 永远返回0,永远返回不了1,所以这个 for 循环会没有终点。一直运行下去。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 如何关闭异常自动关联上下文? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你在处理异常时,由于处理不当或者其他问题,再次抛出另一个异常时,往外抛出的异常也会携带原始的异常信息。 @@ -89,4 +89,4 @@ RuntimeError: Something bad happened -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 自带的缓存机制不用白不用 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 缓存是一种将定量数据加以保存,以备迎合后续获取需求的处理方式,旨在加快数据获取的速度。 @@ -45,4 +45,4 @@ calculating: 2 + 3 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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超大文件 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 使用 with...open... 可以从一个文件中读取数据,这是所有 Python 开发者都非常熟悉的操作。 @@ -60,4 +60,4 @@ def read_from_file(filename, block_size = 1024 * 8): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 的延迟调用 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Golang 中有一种延迟调用的机制,关键字是 defer,例如下面的示例 @@ -49,4 +49,4 @@ B -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 如何快速计算函数运行时间 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 计算一个函数的运行时间,你可能会这样子做 @@ -49,4 +49,4 @@ print(timeit.timeit(lambda :run_sleep(2), number=5)) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 重定向标准输出到日志 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 假设你有一个脚本,会执行一些任务,比如说集群健康情况的检查。 @@ -38,4 +38,4 @@ with close_stdout(): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 快速定位错误进入调试模式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你在写一个程序时,最初的程序一定遇到不少零零散散的错误,这时候就免不了调试一波。 @@ -15,14 +15,14 @@ 方法很简单,只需要你在执行脚本时,加入 `-i` 参考 -![](http://image.iswbm.com/20200615235900.png) +![](https://image.iswbm.com/20200615235900.png) 如果你的程序没有任何问题,加上 `-i` 后又会有什么不一样呢? 从下图可以看出,程序执行完成后会自动进入 console 交互模式。 -![](http://image.iswbm.com/image-20200616000039009.png) +![](https://image.iswbm.com/image-20200616000039009.png) -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 在程序退出前执行代码的技巧 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 使用 atexit 这个内置模块,可以很方便地注册退出函数。 @@ -7,7 +7,7 @@ 示例如下 -![](http://image.iswbm.com/20200510112133.png) +![](https://image.iswbm.com/20200510112133.png) 如果`clean()`函数有参数,那么你可以不用装饰器,而是直接调用`atexit.register(clean_1, 参数1, 参数2, 参数3='xxx')`。 @@ -19,4 +19,4 @@ - 如果发生了严重的 Python 内部错误,你注册的函数无法正常执行。 - 如果你手动调用了`os._exit()`,你注册的函数无法正常执行。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 逗号也有它的独特用法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 逗号,虽然是个很不起眼的符号,但在 Python 中也有他的用武之地。 @@ -44,4 +44,4 @@ for i in range(3): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 如何在运行状态查看源代码? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 查看函数的源代码,我们通常会使用 IDE 来完成。 @@ -38,4 +38,4 @@ def add(x, y): -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 单分派泛函数如何写? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 泛型,如果你尝过java,应该对他不陌生吧。但你可能不知道在 Python 中(3.4+ ),也可以实现 简单的泛型函数。 @@ -158,4 +158,4 @@ hello, world -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 让我爱不释手的用户环境 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你在机器上并没有 root 权限时,如何安装 Python 的第三方包呢? @@ -40,4 +40,4 @@ logout -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 字符串的分割技巧 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当我们对字符串进行分割时,且分割符是 `\n`,有可能会出现这样一个窘境: @@ -68,4 +68,4 @@ b 因此在多个换行符的情况下,请务必使用 split 方法。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 反转字符串/列表最优雅的方式 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 反转序列并不难,但是如何做到最优雅呢? @@ -44,4 +44,4 @@ def my_reverse(str): [3, 2, 1] ``` -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 内容输出到文件 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) Python 3 中的 print 作为一个函数,由于可以接收更多的参数,所以功能变为更加强大。 @@ -16,4 +16,4 @@ hello, python -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 改变默认递归次数限制 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 上面才提到递归,大家都知道使用递归是有风险的,递归深度过深容易导致堆栈的溢出。如果你这字符串太长啦,使用递归方式反转,就会出现问题。 @@ -21,4 +21,4 @@ -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) 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 用法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) if else 用法可以说是最基础的语法表达式之一,但是今天不是讲这个的。 @@ -62,4 +62,4 @@ test_try_else("ming") 总结一下,for else 和 try else 相同,只要代码正常走下去不被 break,不抛出异常,就可以走else。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ 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时不再报错 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当一个字典里没有某个 key 时,此时你访问他是会报 KeyError 的。 @@ -61,4 +61,4 @@ defaultdict( at 0x10ff10488>, {}) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_21.rst b/source/c05/c05_21.rst index 74da09a..c408f23 100644 --- a/source/c05/c05_21.rst +++ b/source/c05/c05_21.rst @@ -66,6 +66,6 @@ defaultdict 接收一个工厂方法,工厂方法返回的对象就是字典 |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_22.md b/source/c05/c05_22.md index 419d0cf..a24330f 100644 --- a/source/c05/c05_22.md +++ b/source/c05/c05_22.md @@ -1,6 +1,6 @@ # 5.22 如何实现函数的连续调用? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 现在我想写一个函数可以实现把所有的数进行求和,并且可以达到反复调用的目的。 @@ -51,4 +51,4 @@ calling __call__ function >>> ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_22.rst b/source/c05/c05_22.rst index a006dd0..0dfaa77 100644 --- a/source/c05/c05_22.rst +++ b/source/c05/c05_22.rst @@ -56,6 +56,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_23.md b/source/c05/c05_23.md index 12c9359..7d808dd 100644 --- a/source/c05/c05_23.md +++ b/source/c05/c05_23.md @@ -1,6 +1,6 @@ # 5.23 如何实现字典的多级排序 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在一个列表中,每个元素都是一个字典,里面的每个字典结构都是一样的。 @@ -45,4 +45,4 @@ -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_23.rst b/source/c05/c05_23.rst index 113631b..87dadde 100644 --- a/source/c05/c05_23.rst +++ b/source/c05/c05_23.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_24.md b/source/c05/c05_24.md index fa8eb51..f49e33b 100644 --- a/source/c05/c05_24.md +++ b/source/c05/c05_24.md @@ -1,6 +1,6 @@ # 5.24 对齐字符串的两种方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 第一种:使用 format @@ -137,4 +137,4 @@ -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_24.rst b/source/c05/c05_24.rst index adb47c3..977b7f4 100644 --- a/source/c05/c05_24.rst +++ b/source/c05/c05_24.rst @@ -143,6 +143,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_25.md b/source/c05/c05_25.md index 8c2a2bb..3ccac58 100644 --- a/source/c05/c05_25.md +++ b/source/c05/c05_25.md @@ -1,6 +1,6 @@ # 5.25 将位置参数变成关键字参数 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Python 中,参数的种类,大概可以分为四种: @@ -29,4 +29,4 @@ TypeError: demo_func() takes 2 positional arguments but 3 were given 3 ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_25.rst b/source/c05/c05_25.rst index 22f6fae..a09f370 100644 --- a/source/c05/c05_25.rst +++ b/source/c05/c05_25.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/c05/c05_26.md b/source/c05/c05_26.md index 52bcf9d..2681e4d 100644 --- a/source/c05/c05_26.md +++ b/source/c05/c05_26.md @@ -1,6 +1,6 @@ # 5.26 如何获取一个函数设定的参数 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Python 中有一个叫 inspect 的库,非常的好用,利用它可以获取一些数据,这在写一些框架时非常有用。 @@ -37,4 +37,4 @@ Traceback (most recent call last): TypeError: missing a required argument: 'age' ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_26.rst b/source/c05/c05_26.rst index 30984e6..8bccf8e 100644 --- a/source/c05/c05_26.rst +++ b/source/c05/c05_26.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_27.md b/source/c05/c05_27.md index 36746ec..54865ed 100644 --- a/source/c05/c05_27.md +++ b/source/c05/c05_27.md @@ -1,6 +1,6 @@ # 5.27 如何进行版本的比较 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 使用 distutils @@ -34,4 +34,4 @@ True -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_27.rst b/source/c05/c05_27.rst index 3a4e50d..60002db 100644 --- a/source/c05/c05_27.rst +++ b/source/c05/c05_27.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_28.md b/source/c05/c05_28.md index 3a6569d..4364c9e 100644 --- a/source/c05/c05_28.md +++ b/source/c05/c05_28.md @@ -18,7 +18,7 @@ 在不进行任何设置的情况下,警告会直接打印在终端上。 -![](http://image.iswbm.com/20210313143425.png) +![](https://image.iswbm.com/20210313143425.png) ## 3. 捕获警告方法一 @@ -49,7 +49,7 @@ except Warning as e: 运行后,效果如下 -![](http://image.iswbm.com/20210313144501.png) +![](https://image.iswbm.com/20210313144501.png) ## 4. 捕获警告方法二 @@ -91,4 +91,4 @@ with warnings.catch_warnings(record=True) as w: 运行后,效果如下 -![](http://image.iswbm.com/20210313144751.png) \ No newline at end of file +![](https://image.iswbm.com/20210313144751.png) \ No newline at end of file diff --git a/source/c05/c05_28.rst b/source/c05/c05_28.rst index 1814d27..abe3b8f 100644 --- a/source/c05/c05_28.rst +++ b/source/c05/c05_28.rst @@ -109,7 +109,7 @@ |image2| -.. |image0| image:: http://image.iswbm.com/20210313143425.png -.. |image1| image:: http://image.iswbm.com/20210313144501.png -.. |image2| image:: http://image.iswbm.com/20210313144751.png +.. |image0| image:: https://image.iswbm.com/20210313143425.png +.. |image1| image:: https://image.iswbm.com/20210313144501.png +.. |image2| image:: https://image.iswbm.com/20210313144751.png diff --git a/source/c05/c05_29.md b/source/c05/c05_29.md index e43ffdf..1cc1d28 100644 --- a/source/c05/c05_29.md +++ b/source/c05/c05_29.md @@ -1,6 +1,6 @@ # 5.29 如何禁止对象深拷贝? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当你使用 copy 模块的 deepcopy 拷贝一个对象后,会创建出来一个全新的的对象。 @@ -43,4 +43,4 @@ class Sentinel(object): 140151569169808 ``` -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c05/c05_29.rst b/source/c05/c05_29.rst index 0d6aa21..8dbe577 100644 --- a/source/c05/c05_29.rst +++ b/source/c05/c05_29.rst @@ -49,6 +49,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/c05/c05_30.md b/source/c05/c05_30.md index 4748400..a4ea883 100644 --- a/source/c05/c05_30.md +++ b/source/c05/c05_30.md @@ -1,6 +1,6 @@ # 5.30 如何将变量名和变量值转为字典? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 千言万语,不如上示例演示下效果 @@ -43,4 +43,4 @@ def varname(*args): 附上 :[inspect 学习文档](https://docs.python.org/zh-cn/3.7/library/inspect.html) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_30.rst b/source/c05/c05_30.rst index 534c79f..a7e236d 100644 --- a/source/c05/c05_30.rst +++ b/source/c05/c05_30.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_31.md b/source/c05/c05_31.md index beb05b7..99a8b50 100644 --- a/source/c05/c05_31.md +++ b/source/c05/c05_31.md @@ -1,6 +1,6 @@ # 5.31 替换实例方法的最佳实践 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 思路一:简单替换 @@ -53,7 +53,7 @@ print(p.speak) 有 Python 2 使用经验的朋友,可以会知道类实例的方法,都有 `im_func` 和 `im_class` 属性,分别指向了该方法的函数和类。 -![](http://image.iswbm.com/20210328111610.png) +![](https://image.iswbm.com/20210328111610.png) 很抱歉的是,这些在 Python3 中全都取消了,意味你无法再使用 `im_func` 和 `im_class` 。 @@ -61,17 +61,17 @@ print(p.speak) 因为在 Python2 中不推荐普通用户对类实例的方法进行替换,所以 Python 给类实例的方法赋予了只读属性 -![](http://image.iswbm.com/20210328111904.png) +![](https://image.iswbm.com/20210328111904.png) ## 思路三:非常危险的字节码替换 表层不行,但这个方法在字节码层面却是可行的 -![](http://image.iswbm.com/20210328112231.png) +![](https://image.iswbm.com/20210328112231.png) 这种方法,非常的粗暴且危险,他会直接影响到使用 People 的所有实例的 speak 方法,因此这种方法千万不要使用。 -![](http://image.iswbm.com/20210328112501.png) +![](https://image.iswbm.com/20210328112501.png) ## 思路四:利用 types 绑定方法 @@ -97,4 +97,4 @@ p.speak() 这种方法,最为安全,不会影响其他实例。并且 Python 2 和 Python 3 都适用,是官方推荐的一种做法。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_31.rst b/source/c05/c05_31.rst index 2e872d3..2cee9b9 100644 --- a/source/c05/c05_31.rst +++ b/source/c05/c05_31.rst @@ -111,10 +111,10 @@ method ,你可以把替换前后的 speak 打印出来 |image5| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210328111610.png -.. |image2| image:: http://image.iswbm.com/20210328111904.png -.. |image3| image:: http://image.iswbm.com/20210328112231.png -.. |image4| image:: http://image.iswbm.com/20210328112501.png -.. |image5| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210328111610.png +.. |image2| image:: https://image.iswbm.com/20210328111904.png +.. |image3| image:: https://image.iswbm.com/20210328112231.png +.. |image4| image:: https://image.iswbm.com/20210328112501.png +.. |image5| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c05/c05_32.md b/source/c05/c05_32.md index 3f358d4..77755f4 100644 --- a/source/c05/c05_32.md +++ b/source/c05/c05_32.md @@ -1,6 +1,6 @@ # 5.32 如何动态创建函数? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在下面的代码中,每一次 for 循环都会创建一个返回特定字符串的函数。 @@ -27,4 +27,4 @@ python -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c05/c05_32.rst b/source/c05/c05_32.rst index 46c3ab0..9f07536 100644 --- a/source/c05/c05_32.rst +++ b/source/c05/c05_32.rst @@ -28,6 +28,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/c06/c06_01.md b/source/c06/c06_01.md index dc87e8a..58dc229 100644 --- a/source/c06/c06_01.md +++ b/source/c06/c06_01.md @@ -1,5 +1,5 @@ # 6.1 不要直接调用类的私有方法 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 大家都知道,类中可供直接调用的方法,只有公有方法(protected类型的方法也可以,但是不建议)。也就是说,类的私有方法是无法直接调用的。 @@ -40,4 +40,4 @@ ins.call_private() ## -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c06/c06_01.rst b/source/c06/c06_01.rst index 77aa6b4..b0ed079 100644 --- a/source/c06/c06_01.rst +++ b/source/c06/c06_01.rst @@ -42,6 +42,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/c06/c06_02.md b/source/c06/c06_02.md index 94b1dfd..dfe9ad4 100644 --- a/source/c06/c06_02.md +++ b/source/c06/c06_02.md @@ -1,5 +1,5 @@ # 6.2 默认参数最好不为可变对象 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 函数的参数分三种 @@ -37,8 +37,8 @@ Python 中的 def 语句在每次执行的时候都初始化一个函数对象 对于参数中提供了初始值的参数,由于 Python 中的函数参数传递的是对象,也可以认为是传地址,在第一次初始化 def 的时候,会先生成这个可变对象的内存地址,然后将这个默认参数 item_list 会与这个内存地址绑定。在后面的函数调用中,如果调用方指定了新的默认值,就会将原来的默认值覆盖。如果调用方没有指定新的默认值,那就会使用原来的默认值。 -![](http://image.iswbm.com/20190511165650.png) +![](https://image.iswbm.com/20190511165650.png) ## -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c06/c06_02.rst b/source/c06/c06_02.rst index ac11fc3..aa06613 100644 --- a/source/c06/c06_02.rst +++ b/source/c06/c06_02.rst @@ -47,7 +47,7 @@ Python 中的 def |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20190511165650.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20190511165650.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c06/c06_03.md b/source/c06/c06_03.md index 9ac278c..e72c106 100644 --- a/source/c06/c06_03.md +++ b/source/c06/c06_03.md @@ -1,5 +1,5 @@ # 6.3 增量赋值的性能更好 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 诸如 `+=` 和 `*=` 这些运算符,叫做 增量赋值运算符。 @@ -21,4 +21,4 @@ a = 1; a = a + 1 所以在能使用增量赋值的时候尽量使用它。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c06/c06_03.rst b/source/c06/c06_03.rst index 70a0867..ddfc16d 100644 --- a/source/c06/c06_03.rst +++ b/source/c06/c06_03.rst @@ -28,6 +28,6 @@ a+b,前者是直接在原列表上进行扩展,而后者是先从原列表中 |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/c06/c06_04.md b/source/c06/c06_04.md index 46b7fb0..5306aea 100644 --- a/source/c06/c06_04.md +++ b/source/c06/c06_04.md @@ -1,5 +1,5 @@ # 6.4 别再使用 pprint 打印了 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 1. 吐槽问题 @@ -144,7 +144,7 @@ MyPrettyPrinter().pprint(info) 输出如下,已经解决了中文的显示问题: -![](http://image.iswbm.com/20200507171451.png) +![](https://image.iswbm.com/20200507171451.png) ### 打印双引号 @@ -245,7 +245,7 @@ MyPrettyPrinter(stream=MyStream()).pprint(info) 就像下面这样。 -![](http://image.iswbm.com/20200507174459.png) +![](https://image.iswbm.com/20200507174459.png) 知道了问题所在,再修改下代码 @@ -270,7 +270,7 @@ MyPrettyPrinter(stream=MyStream()).pprint(info) 终于成功了,太不容易了吧。 -![](http://image.iswbm.com/20200507174802.png) +![](https://image.iswbm.com/20200507174802.png) ## 3. 何必折腾 @@ -345,4 +345,4 @@ json.dumps 的关键参数有两个: 2. 若真要使用,且有和我一样的改造需求,可以参考我的实现 3. Python 2 中的 print 语句后居然可以加 逗号 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c06/c06_04.rst b/source/c06/c06_04.rst index 5191ea1..4d08848 100644 --- a/source/c06/c06_04.rst +++ b/source/c06/c06_04.rst @@ -381,9 +381,9 @@ json.dumps 的关键参数有两个: |image4| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200507171451.png -.. |image2| image:: http://image.iswbm.com/20200507174459.png -.. |image3| image:: http://image.iswbm.com/20200507174802.png -.. |image4| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200507171451.png +.. |image2| image:: https://image.iswbm.com/20200507174459.png +.. |image3| image:: https://image.iswbm.com/20200507174802.png +.. |image4| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c06/c06_05.md b/source/c06/c06_05.md index e7ea9f0..c0334ab 100644 --- a/source/c06/c06_05.md +++ b/source/c06/c06_05.md @@ -1,6 +1,6 @@ # 6.5 变量名与保留关键字冲突怎么办? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 所有的编程语言都有一些保留关键字,这是代码得以编译/解释的基础。 @@ -62,7 +62,7 @@ SyntaxError: invalid syntax 关于这个问题,[PEP8](https://www.python.org/dev/peps/pep-0008/) 建议当你想使用的变量名被关键字所占用时,可以使用 `变量_` 这样在变量后面加一个单下划线的形式来命名,这种后缀一下划线的方式优先于缩写或拼写错误。 -![](http://image.iswbm.com/20200823203106.png) +![](https://image.iswbm.com/20200823203106.png) 有了 PEP8 做为指导,我们可以这样子写了 @@ -72,4 +72,4 @@ SyntaxError: invalid syntax -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_05.rst b/source/c06/c06_05.rst index 25875c4..863b338 100644 --- a/source/c06/c06_05.rst +++ b/source/c06/c06_05.rst @@ -75,7 +75,7 @@ Python 的关键字,可以通过 keyword 这个模块列出来,一共有 33 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200823203106.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200823203106.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c06/c06_06.md b/source/c06/c06_06.md index b08b494..84f078a 100644 --- a/source/c06/c06_06.md +++ b/source/c06/c06_06.md @@ -1,6 +1,6 @@ # 6.6 不想让子类继承的变量名该怎么写? -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 先来看下面这段代码 @@ -42,8 +42,8 @@ class Son(Parent): 验证过程如下: -![](http://image.iswbm.com/20200823205210.png) +![](https://image.iswbm.com/20200823205210.png) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_06.rst b/source/c06/c06_06.rst index 4389c58..0226829 100644 --- a/source/c06/c06_06.rst +++ b/source/c06/c06_06.rst @@ -51,7 +51,7 @@ Parent |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200823205210.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200823205210.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c06/c06_07.md b/source/c06/c06_07.md index 5e075ea..d846a80 100644 --- a/source/c06/c06_07.md +++ b/source/c06/c06_07.md @@ -1,6 +1,6 @@ # 6.7 利用 any 代替 for 循环 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在某些场景下,我们需要判断是否满足某一组集合中任意一个条件 @@ -32,4 +32,4 @@ found = all(thing == other_thing for thing in things) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_07.rst b/source/c06/c06_07.rst index d5be221..80c1958 100644 --- a/source/c06/c06_07.rst +++ b/source/c06/c06_07.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/c06/c06_08.md b/source/c06/c06_08.md index 4a705d3..75ac038 100644 --- a/source/c06/c06_08.md +++ b/source/c06/c06_08.md @@ -1,6 +1,6 @@ # 6.8 不同条件分支里应减少重合度 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 如下是一个简单的条件语句模型 @@ -39,4 +39,4 @@ def process_payment(payment): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_08.rst b/source/c06/c06_08.rst index ac69ff1..fe05f2d 100644 --- a/source/c06/c06_08.rst +++ b/source/c06/c06_08.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/c06/c06_09.md b/source/c06/c06_09.md index 4bfd601..fa418d8 100644 --- a/source/c06/c06_09.md +++ b/source/c06/c06_09.md @@ -1,6 +1,6 @@ # 6.9 如无必要,勿增实体噢 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 删除没必要的调用`keys()` @@ -65,4 +65,4 @@ def state_attributes(self): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_09.rst b/source/c06/c06_09.rst index 08455b4..dc16168 100644 --- a/source/c06/c06_09.rst +++ b/source/c06/c06_09.rst @@ -69,6 +69,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/c06/c06_10.md b/source/c06/c06_10.md index 06d4360..8d514a9 100644 --- a/source/c06/c06_10.md +++ b/source/c06/c06_10.md @@ -1,6 +1,6 @@ # 6.10 保持代码的简洁与可诗性 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 将条件简化为return语句 @@ -22,4 +22,4 @@ def function(): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_10.rst b/source/c06/c06_10.rst index e8be3b4..c25409b 100644 --- a/source/c06/c06_10.rst +++ b/source/c06/c06_10.rst @@ -24,6 +24,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/c06/c06_11.md b/source/c06/c06_11.md index d737c2b..3cb7bc8 100644 --- a/source/c06/c06_11.md +++ b/source/c06/c06_11.md @@ -1,6 +1,6 @@ # 6.11 给模块的私有属性上保险 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 保护对象 @@ -54,4 +54,4 @@ _start_engine() -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_11.rst b/source/c06/c06_11.rst index b93ac41..3bdc7be 100644 --- a/source/c06/c06_11.rst +++ b/source/c06/c06_11.rst @@ -59,6 +59,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/c06/c06_12.md b/source/c06/c06_12.md index 98fe966..510622a 100644 --- a/source/c06/c06_12.md +++ b/source/c06/c06_12.md @@ -1,6 +1,6 @@ # 6.12 变量不能与保留关键字重名 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在 Python 中有很多的保留关键字,这些关键字的使用,不需要我们定义,也不需要我们导入,只要你进入到了 Python 的环境中,就可以立即使用。 @@ -28,4 +28,4 @@ def tag(name,*content,class_): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c06/c06_12.rst b/source/c06/c06_12.rst index 3c81868..7341691 100644 --- a/source/c06/c06_12.rst +++ b/source/c06/c06_12.rst @@ -32,6 +32,6 @@ class,这个有类别的意思,可能你也想使用它来作为变量名, |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/c07/c07_01.md b/source/c07/c07_01.md index 4bce16a..3225a62 100644 --- a/source/c07/c07_01.md +++ b/source/c07/c07_01.md @@ -1,5 +1,5 @@ # 7.1 远程登陆服务器的最佳利器 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在使用 Python 写一些脚本的时候,在某些情况下,我们需要频繁登陆远程服务去执行一次命令,并返回一些结果。 @@ -54,7 +54,7 @@ status, output = subprocess.getstatusoutput(ssh_cmd) 为了解决这几个问题,我搜索了全网关于 Python ssh 的文章,没有看到有完整介绍这方面的技巧的。 -![](http://image.iswbm.com/20200512125643.png) +![](https://image.iswbm.com/20200512125643.png) 为此,我就翻阅了一个很火的 Github 项目: awesome-python-cn (https://github.com/BingmingWong/awesome-python-cn)。 @@ -129,7 +129,7 @@ print(output) 通过调试查看源代码,仍然查不到问题所在,于是去 [Github](https://github.com/amoffat/sh/issues/393) 上搜了下,原来在 2017 年就已经存在这个问题了,到现在 2020 年了还没有修复,看来使用 `sh.ssh` 的人并不多,于是我又“追问”了下,期望能得到回复。 -![](http://image.iswbm.com/20200228085749.png) +![](https://image.iswbm.com/20200228085749.png) 以上这个问题,只有在需要输入密码才会出现,如果设置了机器互信是没有问题的。 @@ -158,11 +158,11 @@ print(my_server.ifconfig()) 最重要的一点是, `sh` 这个模块,仅支持 Linxu/OSX ,在 Windows 你得使用它的兄弟库 - `pbs` ,然后我又去 pypi 看了一眼 [pbs](https://pypi.org/project/pbs/),已经 “年久失修”,没人维护了。 -![](http://image.iswbm.com/20200228093627.png) +![](https://image.iswbm.com/20200228093627.png) 至此,我离 “卒”,就差最后一根稻草了。 -![](http://image.iswbm.com/20200512125643.png) +![](https://image.iswbm.com/20200512125643.png) ## 3. 使用 paramiko @@ -323,7 +323,7 @@ trans.close() 坏事就是:你需要做很多复杂的准备,你可 google 解决,但是我建议你直接放弃,坑太深了。 -![](http://image.iswbm.com/20200228111654.png) +![](https://image.iswbm.com/20200228111654.png) ### 注意事项 @@ -366,4 +366,4 @@ ssh.close() 经过了一番对比,和一些实例的展示,可以看出 Paramiko 是一个专业、让人省心的 ssh 利器,个人认为 Paramiko 模块是运维人员必学模块之一,如果你恰好需要在 Python 代码中实现 ssh 到远程服务器去获取一些信息,那么我把 Paramiko 推荐给你。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c07/c07_01.rst b/source/c07/c07_01.rst index b75c0f2..4940b1a 100644 --- a/source/c07/c07_01.rst +++ b/source/c07/c07_01.rst @@ -391,11 +391,11 @@ Windows,这里就有一件好事,一件坏事了。 |image6| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20200512125643.png -.. |image2| image:: http://image.iswbm.com/20200228085749.png -.. |image3| image:: http://image.iswbm.com/20200228093627.png -.. |image4| image:: http://image.iswbm.com/20200512125643.png -.. |image5| image:: http://image.iswbm.com/20200228111654.png -.. |image6| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20200512125643.png +.. |image2| image:: https://image.iswbm.com/20200228085749.png +.. |image3| image:: https://image.iswbm.com/20200228093627.png +.. |image4| image:: https://image.iswbm.com/20200512125643.png +.. |image5| image:: https://image.iswbm.com/20200228111654.png +.. |image6| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_02.md b/source/c07/c07_02.md index a4f13d6..612dc88 100644 --- a/source/c07/c07_02.md +++ b/source/c07/c07_02.md @@ -1,11 +1,11 @@ # 7.2 代码 BUG 变得酷炫的利器 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 当我们写的一个脚本或程序发生各种不可预知的异常时,如果我们没有进行捕获处理的时候,通常都会致使程序崩溃退出,并且会在终端打印出一堆 **密密麻麻** 的 traceback 堆栈信息来告诉我们,是哪个地方出了问题。 就像这样子,天呐,密集恐惧症要犯了都 -![](http://image.iswbm.com/image-20200307210853246.png) +![](https://image.iswbm.com/image-20200307210853246.png) 上面这段 traceback @@ -40,11 +40,11 @@ $ python3 -m pip install pretty-errors 随便写一个没有使用 pretty-errors ,并且报错了的程序,是这样子的。 -![](http://image.iswbm.com/image-20200307212823345.png) +![](https://image.iswbm.com/image-20200307212823345.png) 而使用了 pretty_errors 后,报错信息被美化成这样了。 -![](http://image.iswbm.com/image-20200307213534278.png) +![](https://image.iswbm.com/image-20200307213534278.png) 是不是感觉清楚了不少,那种密密麻麻带来的焦虑感是不是都消失了呢? @@ -70,21 +70,21 @@ pretty_errors 和其他库不太一样,在一定程度上(如果你使用全 $ python3 -m pretty_errors ``` -![](http://image.iswbm.com/image-20200307214742135.png) +![](https://image.iswbm.com/image-20200307214742135.png) 配置完成后,你再运行任何脚本,traceback 都会自动美化了。 不仅是在我的 iTerm 终端下 -![](http://image.iswbm.com/image-20200307213534278.png) +![](https://image.iswbm.com/image-20200307213534278.png) 在 PyCharm 中也会 -![](http://image.iswbm.com/image-20200307215530270.png) +![](https://image.iswbm.com/image-20200307215530270.png) 唯一的缺点就是,原先在 PyCharm 中的 traceback 可以直接点击 `文件路径` 直接跳转到对应错误文件代码行,而你如果是在 VSCode 可以使用 下面自定义配置的方案解决这个问题(下面会讲到,参数是:`display_link`)。 -![](http://image.iswbm.com/image-20200307215834623.png) +![](https://image.iswbm.com/image-20200307215834623.png) 因此,有些情况下,你并不想设置 `pretty_errors` 全局可用。 @@ -92,7 +92,7 @@ $ python3 -m pretty_errors 只需要再次输入 `python -m pretty_errors`,选择 `C` 即可清除。 -![](http://image.iswbm.com/image-20200307214600749.png) +![](https://image.iswbm.com/image-20200307214600749.png) @@ -162,7 +162,7 @@ if __name__ == "__main__": 在你像上面这样使用 `pretty_errrs.configure` 进行配置时,抛出的异常信息就变成这样了。 -![](http://image.iswbm.com/image-20200308121949011.png) +![](https://image.iswbm.com/image-20200308121949011.png) @@ -194,7 +194,7 @@ if __name__ == "__main__": 其中,`_BACKGROUND` 用于设置背景色,举个例子如下。 -![](http://image.iswbm.com/image-20200308125431779.png) +![](https://image.iswbm.com/image-20200308125431779.png) ### 5.2 设置显示内容 @@ -249,4 +249,4 @@ if __name__ == "__main__": 以上,就是我对 `pretty_errors` 的使用体验,总的来说,这个库功能非常强大,使用效果也特别酷炫,它就跟 PEP8 规范一样,没有它是可以,但是有了它会更好一样。对于某些想自定义错误输出场景的人,`pretty_errors` 会是一个不错的解决方案,明哥把它推荐给你。 -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c07/c07_02.rst b/source/c07/c07_02.rst index 769bee0..40b467c 100644 --- a/source/c07/c07_02.rst +++ b/source/c07/c07_02.rst @@ -270,17 +270,17 @@ PEP8 |image12| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20200307210853246.png -.. |image2| image:: http://image.iswbm.com/image-20200307212823345.png -.. |image3| image:: http://image.iswbm.com/image-20200307213534278.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20200307210853246.png +.. |image2| image:: https://image.iswbm.com/image-20200307212823345.png +.. |image3| image:: https://image.iswbm.com/image-20200307213534278.png .. |image4| image:: https://warehouse-camo.cmh1.psfhosted.org/31399c5a034c3989b9e99b35249e8f2f0d40e102/68747470733a2f2f692e696d6775722e636f6d2f306a7045716f622e706e67 -.. |image5| image:: http://image.iswbm.com/image-20200307214742135.png -.. |image6| image:: http://image.iswbm.com/image-20200307213534278.png -.. |image7| image:: http://image.iswbm.com/image-20200307215530270.png -.. |image8| image:: http://image.iswbm.com/image-20200307215834623.png -.. |image9| image:: http://image.iswbm.com/image-20200307214600749.png -.. |image10| image:: http://image.iswbm.com/image-20200308121949011.png -.. |image11| image:: http://image.iswbm.com/image-20200308125431779.png -.. |image12| image:: http://image.iswbm.com/20200607174235.png +.. |image5| image:: https://image.iswbm.com/image-20200307214742135.png +.. |image6| image:: https://image.iswbm.com/image-20200307213534278.png +.. |image7| image:: https://image.iswbm.com/image-20200307215530270.png +.. |image8| image:: https://image.iswbm.com/image-20200307215834623.png +.. |image9| image:: https://image.iswbm.com/image-20200307214600749.png +.. |image10| image:: https://image.iswbm.com/image-20200308121949011.png +.. |image11| image:: https://image.iswbm.com/image-20200308125431779.png +.. |image12| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_03.md b/source/c07/c07_03.md index 06d3aef..bf58e2b 100644 --- a/source/c07/c07_03.md +++ b/source/c07/c07_03.md @@ -1,5 +1,5 @@ # 7.3 少有人知的 Python "重试机制" -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 为了避免由于一些网络或其他不可控因素,而引起的功能性问题。比如在发送请求时,会因为网络不稳定,往往会有请求超时的问题。 @@ -217,4 +217,4 @@ False -![](http://image.iswbm.com/20200607174235.png) +![](https://image.iswbm.com/20200607174235.png) diff --git a/source/c07/c07_03.rst b/source/c07/c07_03.rst index 62eef2b..c11132e 100644 --- a/source/c07/c07_03.rst +++ b/source/c07/c07_03.rst @@ -222,6 +222,6 @@ RetryError,而不是最根本的原因。 |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/c07/c07_04.md b/source/c07/c07_04.md index 982f7a0..90b09cb 100644 --- a/source/c07/c07_04.md +++ b/source/c07/c07_04.md @@ -1,6 +1,6 @@ # 7.4 规整字符串提取数据的神器 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 从一段指定的字符串中,取得期望的数据,正常人都会想到正则表达式吧? @@ -28,7 +28,7 @@ cookie=0x9816da8e872d717d, duration=298506.364s, table=0, n_packets=480, n_bytes 我来给你展示一下,我是怎么做的? -![](http://image.iswbm.com/image-20200903214325849.png) +![](https://image.iswbm.com/image-20200903214325849.png) 可以看到,我使用了一个叫做 parse 的第三方包,是需要自行安装的 @@ -306,4 +306,4 @@ parse 库在字符串解析处理场景中提供的便利,肉眼可见,上 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_04.rst b/source/c07/c07_04.rst index 157e501..5ca9392 100644 --- a/source/c07/c07_04.rst +++ b/source/c07/c07_04.rst @@ -358,7 +358,7 @@ level,用它写出来的代码富有美感,可读性高,后期维护起代 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20200903214325849.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20200903214325849.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_05.md b/source/c07/c07_05.md index c6d40a9..dc1cd44 100644 --- a/source/c07/c07_05.md +++ b/source/c07/c07_05.md @@ -1,6 +1,6 @@ # 7.5 一行代码让代码运行速度提高100倍 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) python一直被病垢运行速度太慢,但是实际上python的执行效率并不慢,慢的是python用的解释器Cpython运行效率太差。 @@ -275,4 +275,4 @@ numba所完成的工作就是:解析Python函数的ast语法树并加以改造 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_05.rst b/source/c07/c07_05.rst index 037c03f..f6bfbf6 100644 --- a/source/c07/c07_05.rst +++ b/source/c07/c07_05.rst @@ -280,6 +280,6 @@ numba所完成的工作就是:解析Python函数的ast语法树并加以改造 |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/c07/c07_06.md b/source/c07/c07_06.md index eb1e9f5..9f1d5d4 100644 --- a/source/c07/c07_06.md +++ b/source/c07/c07_06.md @@ -1,6 +1,6 @@ # 7.6 新一代的调试神器:PySnooper -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 对于每个程序开发者来说,调试几乎是必备技能。 @@ -121,7 +121,7 @@ def demo_func(): 如此一来,PySnooper 会在 `out["foo"]` 值有变化时,也将其打印出来 -![](http://image.iswbm.com/20201114183018.png) +![](https://image.iswbm.com/20201114183018.png) watch 参数,接收一个可迭代对象(可以是list 或者 tuple),里面的元素为字符串表达式,什么意思呢?看下面例子就知道了 @@ -165,7 +165,7 @@ def demo_func(): 效果如下 -![](http://image.iswbm.com/20201114193131.png) +![](https://image.iswbm.com/20201114193131.png) ### 3.5 设置最大的输出长度 @@ -201,7 +201,7 @@ def demo_func(): 效果如下 -![](http://image.iswbm.com/20201114194449.png) +![](https://image.iswbm.com/20201114194449.png) @@ -262,7 +262,7 @@ main() 运行一下,观察一下效果。 -![](http://image.iswbm.com/20201114201042.png) +![](https://image.iswbm.com/20201114201042.png) @@ -306,4 +306,4 @@ def demo_func(): -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_06.rst b/source/c07/c07_06.rst index 4d82163..070cce1 100644 --- a/source/c07/c07_06.rst +++ b/source/c07/c07_06.rst @@ -330,10 +330,10 @@ PySnooper 在打印对象的调试信息时,会逐个判断它是否是 Person |image5| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20201114183018.png -.. |image2| image:: http://image.iswbm.com/20201114193131.png -.. |image3| image:: http://image.iswbm.com/20201114194449.png -.. |image4| image:: http://image.iswbm.com/20201114201042.png -.. |image5| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20201114183018.png +.. |image2| image:: https://image.iswbm.com/20201114193131.png +.. |image3| image:: https://image.iswbm.com/20201114194449.png +.. |image4| image:: https://image.iswbm.com/20201114201042.png +.. |image5| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_07.md b/source/c07/c07_07.md index 6743c2d..7199e14 100644 --- a/source/c07/c07_07.md +++ b/source/c07/c07_07.md @@ -1,6 +1,6 @@ # 7.7 比open更好用、更优雅的读取文件 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 使用 open 函数去读取文件,似乎是所有 Python 工程师的共识。 @@ -249,7 +249,7 @@ UNIX转DOS::setfileformat=dos 若你没有传入任何的勾子,fileinput 默认使用的是 open 函数。 -![](http://image.iswbm.com/image-20210227095708676.png) +![](https://image.iswbm.com/image-20210227095708676.png) `fileinput` 为我们内置了两种勾子供你使用 @@ -406,4 +406,4 @@ fileinput 是对 open 函数的再次封装,在仅需读取数据的场景中 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_07.rst b/source/c07/c07_07.rst index 34b3afd..96095ce 100644 --- a/source/c07/c07_07.rst +++ b/source/c07/c07_07.rst @@ -448,7 +448,7 @@ fileinput 是对 open 函数的再次封装,在仅需读取数据的场景中 |image2| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20210227095708676.png -.. |image2| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20210227095708676.png +.. |image2| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_08.md b/source/c07/c07_08.md index cdf2d48..231a167 100644 --- a/source/c07/c07_08.md +++ b/source/c07/c07_08.md @@ -1,6 +1,6 @@ # 7.8 像操作路径一样,操作嵌套字典 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 在使用前先安装它,要注意的是该模块只能在 Python 3.8+ 中使用 @@ -47,4 +47,4 @@ print(dpath.util.values(data, "/foo/bar/*")) -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_08.rst b/source/c07/c07_08.rst index 8af9138..1e03b72 100644 --- a/source/c07/c07_08.rst +++ b/source/c07/c07_08.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/c07/c07_09.md b/source/c07/c07_09.md index 98d0546..6cbc467 100644 --- a/source/c07/c07_09.md +++ b/source/c07/c07_09.md @@ -1,6 +1,6 @@ # 7.9 读取文件中任意行的数据 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) `linecache` 是 Python 中的一个内置模块。 @@ -23,4 +23,4 @@ >>> ``` -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_09.rst b/source/c07/c07_09.rst index 1e56d71..eac3c16 100644 --- a/source/c07/c07_09.rst +++ b/source/c07/c07_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/c07/c07_10.md b/source/c07/c07_10.md index 2e03aa4..0019cde 100644 --- a/source/c07/c07_10.md +++ b/source/c07/c07_10.md @@ -1,6 +1,6 @@ # 7.10 让你的装饰器写得更轻松的神库 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 本篇文章会为你介绍的是一个已经存在十三年,但是依旧不红的库 decorator,好像很少有人知道他的存在一样。 @@ -37,11 +37,11 @@ myfunc() 有一些比较聪明的同学,会利用 PyCharm 来自动生成装饰器模板 -![](http://image.iswbm.com/image-20210420211718252.png) +![](https://image.iswbm.com/image-20210420211718252.png) 然后要使用的时候,直接敲入 `deco` 就会生成一个简单的生成器代码,提高编码的准备效率 -![](http://image.iswbm.com/deco.gif) +![](https://image.iswbm.com/deco.gif) ## 2. 使用神库 @@ -222,4 +222,4 @@ print(myfunc.__name__) 这么棒的一个库,推荐你使用起来。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_10.rst b/source/c07/c07_10.rst index bd38534..0ad7d87 100644 --- a/source/c07/c07_10.rst +++ b/source/c07/c07_10.rst @@ -248,8 +248,8 @@ deco |image3| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/image-20210420211718252.png -.. |image2| image:: http://image.iswbm.com/deco.gif -.. |image3| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/image-20210420211718252.png +.. |image2| image:: https://image.iswbm.com/deco.gif +.. |image3| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_11.md b/source/c07/c07_11.md index 42ba718..c9779d2 100644 --- a/source/c07/c07_11.md +++ b/source/c07/c07_11.md @@ -1,6 +1,6 @@ # 7.11 国际化模块,让翻译更优雅 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) ## 国际化与本地化 @@ -68,4 +68,4 @@ $ msgfmt locale/zh_CN/LC_MESSAGES/hello.po -o locale/zh_CN/LC_MESSAGES/hello.mo -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_11.rst b/source/c07/c07_11.rst index ef595c2..c6f547b 100644 --- a/source/c07/c07_11.rst +++ b/source/c07/c07_11.rst @@ -75,6 +75,6 @@ gettext 是一套 GNU下的国际化工具。主要有工具: |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/c07/c07_12.md b/source/c07/c07_12.md index 6962ed2..04f3746 100644 --- a/source/c07/c07_12.md +++ b/source/c07/c07_12.md @@ -1,6 +1,6 @@ # 7.12 非常好用的调度模块 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) Python 自带一个调度器模块`sched`,它能为你实现优先级队列/延迟队列和定时队列。 @@ -19,7 +19,7 @@ sch.run() 代码运行以后,会卡在`sch.run()`这里,5秒钟以后执行`do_work('iswbm')`,运行效果如下图所示: -![](http://image.iswbm.com/20210521215217.png) +![](https://image.iswbm.com/20210521215217.png) 其中,`sch.enter()`的第一个参数为延迟的时间,单位为秒,第二个参数为优先级,数字越小优先级越高。当两个任务同时要执行时,优先级高的先执行。但需要注意的是,如果你这样写: @@ -37,7 +37,7 @@ sch.run() 那么先打印出来的是`你好:python` -![](http://image.iswbm.com/20210521215257.png) +![](https://image.iswbm.com/20210521215257.png) 为什么这里优先级失效了?1的优先级大于2,应该先运行下面的才对啊。 @@ -63,7 +63,7 @@ sch.run() 运行效果如下图所示: -![](http://image.iswbm.com/20210521215402.png) +![](https://image.iswbm.com/20210521215402.png) `sch.enterabs()`的第一个参数是任务开始时间的时间戳,这是一个绝对时间,这个时间可以使用datetime模块来生成,或者其他你熟悉的方式。后面的参数和`sch.enter()`完全一样。 @@ -91,4 +91,4 @@ argument参数对应的元组存放普通参数,kwargs对应的字典存放带 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_12.rst b/source/c07/c07_12.rst index ca97650..4f9a61f 100644 --- a/source/c07/c07_12.rst +++ b/source/c07/c07_12.rst @@ -93,9 +93,9 @@ argument参数对应的元组存放普通参数,kwargs对应的字典存放带 |image4| -.. |image0| image:: http://image.iswbm.com/20200804124133.png -.. |image1| image:: http://image.iswbm.com/20210521215217.png -.. |image2| image:: http://image.iswbm.com/20210521215257.png -.. |image3| image:: http://image.iswbm.com/20210521215402.png -.. |image4| image:: http://image.iswbm.com/20200607174235.png +.. |image0| image:: https://image.iswbm.com/20200804124133.png +.. |image1| image:: https://image.iswbm.com/20210521215217.png +.. |image2| image:: https://image.iswbm.com/20210521215257.png +.. |image3| image:: https://image.iswbm.com/20210521215402.png +.. |image4| image:: https://image.iswbm.com/20200607174235.png diff --git a/source/c07/c07_13.md b/source/c07/c07_13.md index 3b84503..0ab370f 100644 --- a/source/c07/c07_13.md +++ b/source/c07/c07_13.md @@ -1,6 +1,6 @@ # 7.13 实现字典的点式操作 -![](http://image.iswbm.com/20200804124133.png) +![](https://image.iswbm.com/20200804124133.png) 字典是 Python 中基础的数据结构之一,字典的使用,可以说是非常的简单粗暴,但即便是这样一个与世无争的数据结构,仍然有很多人 "用不惯它" 。 @@ -245,4 +245,4 @@ SyntaxError: invalid syntax 也正是因为这样,原生字典至今还是不可替代的存在。 -![](http://image.iswbm.com/20200607174235.png) \ No newline at end of file +![](https://image.iswbm.com/20200607174235.png) \ No newline at end of file diff --git a/source/c07/c07_13.rst b/source/c07/c07_13.rst index 7efe641..abe69c0 100644 --- a/source/c07/c07_13.rst +++ b/source/c07/c07_13.rst @@ -270,6 +270,6 @@ Munch 支持序列化为 JSON 或者 YAML 格式的字符串对象 |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/chapters/p01.rst b/source/chapters/p01.rst index 75fb487..aab827f 100644 --- a/source/chapters/p01.rst +++ b/source/chapters/p01.rst @@ -17,4 +17,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p02.rst b/source/chapters/p02.rst index dea9213..5da7190 100644 --- a/source/chapters/p02.rst +++ b/source/chapters/p02.rst @@ -14,4 +14,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p03.rst b/source/chapters/p03.rst index f3b372c..61ae975 100644 --- a/source/chapters/p03.rst +++ b/source/chapters/p03.rst @@ -16,4 +16,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p04.rst b/source/chapters/p04.rst index 987245c..e08a0c6 100644 --- a/source/chapters/p04.rst +++ b/source/chapters/p04.rst @@ -26,4 +26,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p05.rst b/source/chapters/p05.rst index 93c3e51..3796554 100644 --- a/source/chapters/p05.rst +++ b/source/chapters/p05.rst @@ -16,4 +16,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p06.rst b/source/chapters/p06.rst index 8e6ac2d..96eb7d3 100644 --- a/source/chapters/p06.rst +++ b/source/chapters/p06.rst @@ -16,4 +16,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/chapters/p07.rst b/source/chapters/p07.rst index 5e6535c..3909491 100644 --- a/source/chapters/p07.rst +++ b/source/chapters/p07.rst @@ -16,4 +16,4 @@ -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/index.rst b/source/index.rst index a2d0783..1d0a60b 100644 --- a/source/index.rst +++ b/source/index.rst @@ -20,4 +20,4 @@ Contents: -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/preface.rst b/source/preface.rst index 4d459b6..55d811c 100755 --- a/source/preface.rst +++ b/source/preface.rst @@ -22,5 +22,5 @@ Python 是一门对编程新手非常友好的语言,通常花个两个月的 ------------------------------ -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png diff --git a/source/roadmap.rst b/source/roadmap.rst index 970211d..dff914b 100755 --- a/source/roadmap.rst +++ b/source/roadmap.rst @@ -12,4 +12,4 @@ Roadmap -------------- -.. figure:: http://image.iswbm.com/20200607174235.png +.. figure:: https://image.iswbm.com/20200607174235.png From f19fccae40dd232ba19fe9231952e3205811e955 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:29:34 +0800 Subject: [PATCH 2/2] Use https for python.iswbm.com --- md2rst.py | 6 +++--- source/robots.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/md2rst.py b/md2rst.py index e7846d4..d11c300 100644 --- a/md2rst.py +++ b/md2rst.py @@ -24,7 +24,7 @@ # 没有文件变更 os._exit(0) -base_link = "http://python.iswbm.com/en/latest/" +base_link = "https://python.iswbm.com/en/latest/" readme_header = ''' ![](https://image.iswbm.com/20200607120940.png) @@ -36,9 +36,9 @@

-## [项目主页](http://python.iswbm.com/) +## [项目主页](https://python.iswbm.com/) -在线阅读:[Python 编程时光](http://python.iswbm.com/) +在线阅读:[Python 编程时光](https://python.iswbm.com/) ![](https://image.iswbm.com/20200607130051.png) diff --git a/source/robots.txt b/source/robots.txt index 7a43cbb..011a2e0 100644 --- a/source/robots.txt +++ b/source/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Sitemap: http://magic.iswbm.com/sitemap.xml +Sitemap: https://magic.iswbm.com/sitemap.xml