Skip to content

Commit e1f8eb5

Browse files
committed
update
1 parent 907f164 commit e1f8eb5

2 files changed

Lines changed: 209 additions & 9 deletions

File tree

README.md

Lines changed: 138 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](http://image.iswbm.com/image-20200607140915244.png)
1+
![](http://image.iswbm.com/image-20201117214825880.png)
22

33
<p align="center">
44
<img src='https://img.shields.io/badge/language-Python-blue.svg' alt="Build Status">
@@ -13,18 +13,147 @@
1313

1414
在线阅读:[Python 编程时光](http://python.iswbm.com/)
1515

16-
![](http://image.iswbm.com/20200607130051.png)
17-
18-
## 文章结构
19-
20-
![](http://image.iswbm.com/20200607131339.png)
21-
22-
16+
- **第一章:基础知识**
17+
* [1.1 13条Python2.x和3.x的区别?](http://python.iswbm.com/en/latest/c01/c01_01.html)
18+
* [1.2 Python 自省机制详解](http://python.iswbm.com/en/latest/c01/c01_02.html)
19+
* [1.3 /usr/bin/env python 有什么用?](http://python.iswbm.com/en/latest/c01/c01_03.html)
20+
* [1.4 什么是猴子补丁?](http://python.iswbm.com/en/latest/c01/c01_04.html)
21+
* [1.5 深入闭包与变量作用域](http://python.iswbm.com/en/latest/c01/c01_05.html)
22+
* [1.6 有了列表,为什么 Python 还有元组?](http://python.iswbm.com/en/latest/c01/c01_06.html)
23+
* [1.7 15个Pythonic的代码示例](http://python.iswbm.com/en/latest/c01/c01_07.html)
24+
* [1.8 新式类和经典类的区别?](http://python.iswbm.com/en/latest/c01/c01_08.html)
25+
* [1.9 多继承与Mixin设计模式](http://python.iswbm.com/en/latest/c01/c01_09.html)
26+
* [1.10 如何修改 CentOS 6.x 上默认Python](http://python.iswbm.com/en/latest/c01/c01_10.html)
27+
* [1.11 正则表达式必知必会](http://python.iswbm.com/en/latest/c01/c01_11.html)
28+
* [1.12 搞懂字符编码的前世今生](http://python.iswbm.com/en/latest/c01/c01_12.html)
29+
* [1.13 别再使用 pprint 打印字典了](http://python.iswbm.com/en/latest/c01/c01_13.html)
30+
* [1.14 with 与 上下文管理器](http://python.iswbm.com/en/latest/c01/c01_14.html)
31+
* [1.21 Python 开发的几个小 Tips](http://python.iswbm.com/en/latest/c01/c01_15.html)
32+
* [1.16 泛型函数怎么写?](http://python.iswbm.com/en/latest/c01/c01_16.html)
33+
* [1.17 详解 Python 中的编码问题](http://python.iswbm.com/en/latest/c01/c01_17.html)
34+
* [1.18 MySQL 使用总结](http://python.iswbm.com/en/latest/c01/c01_18.html)
35+
* [1.19 如何调试已经运行中的程序](http://python.iswbm.com/en/latest/c01/c01_19.html)
36+
* [1.20 在 CentOS 7.2 上安装 Python3.7](http://python.iswbm.com/en/latest/c01/c01_20.html)
37+
* [1.21 Python 炫技操作:连接列表的八种方法](http://python.iswbm.com/en/latest/c01/c01_21.html)
38+
* [1.22 Python 炫技操作:海象运算符的三种用法](http://python.iswbm.com/en/latest/c01/c01_22.html)
39+
* [1.23 Python 炫技操作:模块重载的五种方法](http://python.iswbm.com/en/latest/c01/c01_23.html)
40+
* [1.24 Python 炫技操作:条件语句的七种写法](http://python.iswbm.com/en/latest/c01/c01_24.html)
41+
* [1.25 Python炫技操作:花式导包的八种方法](http://python.iswbm.com/en/latest/c01/c01_25.html)
42+
* [1.26 Python 炫技操作:合并字典的七种方法](http://python.iswbm.com/en/latest/c01/c01_26.html)
43+
* [1.27 Python 炫技操作:判断是否包含子串的七种方法](http://python.iswbm.com/en/latest/c01/c01_27.html)
44+
- **第二章:并发编程**
45+
* [2.1 从性能角度初探并发编程](http://python.iswbm.com/en/latest/c02/c02_01.html)
46+
* [2.2 创建多线程的几种方法](http://python.iswbm.com/en/latest/c02/c02_02.html)
47+
* [2.3 谈谈线程中的“锁机制”](http://python.iswbm.com/en/latest/c02/c02_03.html)
48+
* [2.4 线程消息通信机制](http://python.iswbm.com/en/latest/c02/c02_04.html)
49+
* [2.5 线程中的信息隔离](http://python.iswbm.com/en/latest/c02/c02_05.html)
50+
* [2.6 线程池创建的几种方法](http://python.iswbm.com/en/latest/c02/c02_06.html)
51+
* [2.7 从生成器使用入门协程](http://python.iswbm.com/en/latest/c02/c02_07.html)
52+
* [2.8 深入理解yield from语法](http://python.iswbm.com/en/latest/c02/c02_08.html)
53+
* [2.9 初识异步IO框架:asyncio 上篇](http://python.iswbm.com/en/latest/c02/c02_09.html)
54+
* [2.10 深入异步IO框架:asyncio 中篇](http://python.iswbm.com/en/latest/c02/c02_10.html)
55+
* [2.11 实战异步IO框架:asyncio 下篇](http://python.iswbm.com/en/latest/c02/c02_11.html)
56+
* [2.12 生成器与协程,你分清了吗?](http://python.iswbm.com/en/latest/c02/c02_12.html)
57+
* [2.13 I/O多路复用:select/poll/epoll](http://python.iswbm.com/en/latest/c02/c02_13.html)
58+
* [2.14 浅谈线程安全那些事儿](http://python.iswbm.com/en/latest/c02/c02_14.html)
59+
- **第三章:高级编程**
60+
* [3.1 装饰器进阶用法详解](http://python.iswbm.com/en/latest/c03/c03_01.html)
61+
* [3.2 深入理解Python元类](http://python.iswbm.com/en/latest/c03/c03_02.html)
62+
* [3.3 Socket编程实现在线聊天](http://python.iswbm.com/en/latest/c03/c03_03.html)
63+
* [3.4 Django+Uwsgi部署网站](http://python.iswbm.com/en/latest/c03/c03_04.html)
64+
* [3.5 源码解读:Flask上下文与代理模式](http://python.iswbm.com/en/latest/c03/c03_05.html)
65+
* [3.6 Web开发者必看:理解WSGI](http://python.iswbm.com/en/latest/c03/c03_06.html)
66+
* [3.7 超实用10 条 Python使用技巧](http://python.iswbm.com/en/latest/c03/c03_07.html)
67+
* [3.8 深入理解 Python 中的描述符](http://python.iswbm.com/en/latest/c03/c03_08.html)
68+
* [1.24 深入探讨 Python 的 import 机制:实现远程导入模块](http://python.iswbm.com/en/latest/c03/c03_09.html)
69+
* [3.10 Python几个高阶函数](http://python.iswbm.com/en/latest/c03/c03_10.html)
70+
* [3.11 with 与 上下文管理器](http://python.iswbm.com/en/latest/c03/c03_11.html)
71+
* [3.12 静态方法其实暗藏玄机](http://python.iswbm.com/en/latest/c03/c03_12.html)
72+
* [3.13 包导入的三个冷门知识点](http://python.iswbm.com/en/latest/c03/c03_13.html)
73+
* [3.14 全面学习 Python 包:包的构建与分发](http://python.iswbm.com/en/latest/c03/c03_14.html)
74+
- **第四章:开发工具**
75+
* [4.1 虚拟环境:virtualenv](http://python.iswbm.com/en/latest/c04/c04_01.html)
76+
* [4.2 虚拟环境:Pipenv](http://python.iswbm.com/en/latest/c04/c04_02.html)
77+
* [4.3 30分钟教你搭建一个博客](http://python.iswbm.com/en/latest/c04/c04_03.html)
78+
* [4.4 Jupyter NoteBook 使用指南](http://python.iswbm.com/en/latest/c04/c04_04.html)
79+
* [4.5 最全的 pip 使用指南](http://python.iswbm.com/en/latest/c04/c04_05.html)
80+
* [4.6 我的 Git 使用指南](http://python.iswbm.com/en/latest/c04/c04_06.html)
81+
* [4.7 Hexo 搭建博客教程](http://python.iswbm.com/en/latest/c04/c04_07.html)
82+
* [4.8 珍惜生命,远离鼠标](http://python.iswbm.com/en/latest/c04/c04_08.html)
83+
* [4.9 MySQL的基本使用](http://python.iswbm.com/en/latest/c04/c04_09.html)
84+
* [4.10 MySQL的高级进阶](http://python.iswbm.com/en/latest/c04/c04_10.html)
85+
* [4.11 超详细图文教你如何使用 PyCharm 进行远程调试](http://python.iswbm.com/en/latest/c04/c04_11.html)
86+
* [4.12 服务器调试神器:pdb](http://python.iswbm.com/en/latest/c04/c04_12.html)
87+
* [4.13 命令行解析工具:argparse](http://python.iswbm.com/en/latest/c04/c04_13.html)
88+
* [4.2 Xshell的高效使用手册](http://python.iswbm.com/en/latest/c04/c04_14.html)
89+
* [4.15 30个 PyCharm 实用技巧](http://python.iswbm.com/en/latest/c04/c04_15.html)
90+
* [4.16 程序员编码必学:Vim](http://python.iswbm.com/en/latest/c04/c04_16.html)
91+
* [4.17 详解 23 种设计模式](http://python.iswbm.com/en/latest/c04/c04_17.html)
92+
* [4.18 如何用好 Python的用户环境?](http://python.iswbm.com/en/latest/c04/c04_18.html)
93+
- **第五章:算法教程**
94+
* [5.1 图解九大经典排序算法](http://python.iswbm.com/en/latest/c05/c05_01.html)
95+
* [5.2 递归算法:走楼梯会思考的题](http://python.iswbm.com/en/latest/c05/c05_02.html)
96+
* [5.3 哈希算法:安全方面的算法应用](http://python.iswbm.com/en/latest/c05/c05_03.html)
97+
- **第六章:数据分析**
98+
* [6.1 一张图带你入门matplotlib](http://python.iswbm.com/en/latest/c06/c06_01.html)
99+
* [6.2 详解六种可视化图表](http://python.iswbm.com/en/latest/c06/c06_02.html)
100+
* [6.3 如何绘制正余弦函数图象](http://python.iswbm.com/en/latest/c06/c06_03.html)
101+
* [6.4 子图与子区 难点突破](http://python.iswbm.com/en/latest/c06/c06_04.html)
102+
* [6.5 绘制酷炫的gif动态图](http://python.iswbm.com/en/latest/c06/c06_05.html)
103+
* [6.6 自动生成图像视频](http://python.iswbm.com/en/latest/c06/c06_06.html)
104+
- **第七章:运维人生**
105+
* [7.1 Linux 命令行的艺术](http://python.iswbm.com/en/latest/c07/c07_01.html)
106+
* [7.2 Zabbix 监控部署文档](http://python.iswbm.com/en/latest/c07/c07_02.html)
107+
* [7.3 Docker:Hello world](http://python.iswbm.com/en/latest/c07/c07_03.html)
108+
* [7.4 Docker:关于镜像](http://python.iswbm.com/en/latest/c07/c07_04.html)
109+
* [7.5 Docker:网络通信](http://python.iswbm.com/en/latest/c07/c07_05.html)
110+
* [7.6 Docker:存储与多主机](http://python.iswbm.com/en/latest/c07/c07_06.html)
111+
* [7.7 SaltStack 入门指南](http://python.iswbm.com/en/latest/c07/c07_07.html)
112+
* [7.8 Keepalived 部署文档](http://python.iswbm.com/en/latest/c07/c07_08.html)
113+
* [7.9 Ansible 入门指南使用手册](http://python.iswbm.com/en/latest/c07/c07_09.html)
114+
* [7.10 Ansible API 最全使用文档(中文)](http://python.iswbm.com/en/latest/c07/c07_10.html)
115+
* [7.11 K8S:基础入门](http://python.iswbm.com/en/latest/c07/c07_11.html)
116+
* [7.12 yum 命令使用指南及问题排查方法](http://python.iswbm.com/en/latest/c07/c07_12.html)
117+
* [7.13 基于 ansible-api 二次开发](http://python.iswbm.com/en/latest/c07/c07_13.html)
118+
* [7.14 Linux 如何写判断语句](http://python.iswbm.com/en/latest/c07/c07_14.html)
119+
* [7.15 Mariadb 与 Galera 集群总结](http://python.iswbm.com/en/latest/c07/c07_15.html)
120+
* [7.16 Linux 运维之路](http://python.iswbm.com/en/latest/c07/c07_16.html)
121+
* [1.17 ansible 自定义 Jinja2 过滤器](http://python.iswbm.com/en/latest/c07/c07_17.html)
122+
* [7.18 Shell中去除字符串前后空格的方法](http://python.iswbm.com/en/latest/c07/c07_18.html)
123+
* [7.19 Ansible 使用教程](http://python.iswbm.com/en/latest/c07/c07_19.html)
124+
* [7.20 使用 Shell 删除文件的多种方法](http://python.iswbm.com/en/latest/c07/c07_20.html)
125+
* [7.21 如何快速创建超大文件?](http://python.iswbm.com/en/latest/c07/c07_21.html)
126+
* [7.22 rpm 命令详细用法](http://python.iswbm.com/en/latest/c07/c07_22.html)
127+
- **第八章:OpenStack**
128+
* [8.1 OpenStack 运维命令](http://python.iswbm.com/en/latest/c08/c08_01.html)
129+
* [8.2 OpenStack 部署SR-IOV](http://python.iswbm.com/en/latest/c08/c08_02.html)
130+
* [8.3 制作 OpenStack 镜像](http://python.iswbm.com/en/latest/c08/c08_03.html)
131+
* [8.4 云计算与虚拟化入门通识](http://python.iswbm.com/en/latest/c08/c08_04.html)
132+
* [8.5 OpenStack 源码剖析与改造](http://python.iswbm.com/en/latest/c08/c08_05.html)
133+
* [8.6 源码解读:Cloud-Init](http://python.iswbm.com/en/latest/c08/c08_06.html)
134+
* [8.7 OpenStack 实现GPU直通](http://python.iswbm.com/en/latest/c08/c08_07.html)
135+
* [8.8 OpenStack 如何使用DHCP?](http://python.iswbm.com/en/latest/c08/c08_08.html)
136+
* [8.9 从0到1:全面理解RPC远程调用](http://python.iswbm.com/en/latest/c08/c08_09.html)
137+
* [8.16 修改 KVM 镜像文件的三种方法](http://python.iswbm.com/en/latest/c08/c08_10.html)
138+
* [8.11 OpenStack 问题排查](http://python.iswbm.com/en/latest/c08/c08_11.html)
139+
* [8.12 OpenStack之主机调度](http://python.iswbm.com/en/latest/c08/c08_12.html)
140+
* [8.13 网络知识必知必会](http://python.iswbm.com/en/latest/c08/c08_13.html)
141+
* [8.14 支持 IPv6以及多运营商](http://python.iswbm.com/en/latest/c08/c08_14.html)
142+
* [8.15 Neutron 源码解读](http://python.iswbm.com/en/latest/c08/c08_15.html)
143+
* [8.16 详解 Neutron 的 QoS](http://python.iswbm.com/en/latest/c08/c08_16.html)
144+
- **第九章:有趣的工具**
145+
* [9.1 情人节来了,教你使用 Python 来表白](http://python.iswbm.com/en/latest/c09/c09_01.html)
146+
* [9.2 我在Mac 上使用哪些APP?](http://python.iswbm.com/en/latest/c09/c09_02.html)
147+
* [9.3 明哥的在线工具集](http://python.iswbm.com/en/latest/c09/c09_03.html)
148+
* [9.4 书籍推荐](http://python.iswbm.com/en/latest/c09/c09_04.html)
149+
* [9.5 让Python 执行任意代码时,都会自动念一段 『平安经』](http://python.iswbm.com/en/latest/c09/c09_05.html)
150+
* [9.6 赶紧收藏!学习 Python 的好网站](http://python.iswbm.com/en/latest/c09/c09_06.html)
151+
* [9.7 解决网页上不能复制的几个小技巧](http://python.iswbm.com/en/latest/c09/c09_07.html)
23152

24153
## 欢迎交流
25154

26155
对文章有什么疑问,对项目有什么建议,可以添加微信与我交流,同时欢迎关注我的个人微信公众号。
27156

28-
![](http://image.iswbm.com/20200607140327.png)
157+
![](http://image.iswbm.com/image-20201117215520960.png)
29158

30159

github-toc-maker-for-sphinx.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import os
2+
import re
3+
from glob import glob
4+
5+
pwd = os.getcwd()
6+
all_chapters_path = glob(pwd + "/source/c0*")
7+
8+
9+
def get_chapter_name(file):
10+
with open(file) as f:
11+
f.readline()
12+
chapter_name = f.readline().strip()
13+
14+
return chapter_name
15+
16+
def get_title(file):
17+
with open(file) as f:
18+
first_line = f.readline()
19+
20+
if first_line.startswith("#"):
21+
return first_line[1:].strip()
22+
23+
def generate_mapping():
24+
mapping = dict.fromkeys([os.path.basename(chapter_path) for chapter_path in all_chapters_path])
25+
for key in mapping.keys():
26+
chapter_file = os.path.join(pwd, "source", "chapters", key.replace("c", "p") + ".rst")
27+
mapping[key] = get_chapter_name(chapter_file)
28+
29+
return mapping
30+
31+
def get_toc_info():
32+
toc = {}
33+
for dir_path in all_chapters_path:
34+
dir_name = os.path.basename(dir_path)
35+
36+
chapter_toc = {}
37+
files = glob(dir_path + "/*.md")
38+
39+
for file in files:
40+
file_name = os.path.basename(file)
41+
section = int(re.findall(r"c\d{2}_(\d{2}).md", file_name)[0])
42+
43+
#md_path = os.path.join("./source/", dir_name, file_name)
44+
md_path = os.path.join("http://python.iswbm.com/en/latest/", dir_name, file_name.replace("md", "html"))
45+
title = get_title(file)
46+
if not title:
47+
continue
48+
49+
chapter_toc[section] = (title, md_path)
50+
51+
toc[dir_name] = chapter_toc
52+
53+
return toc
54+
55+
def print_md_toc(toc_info, mapping):
56+
for chapter in sorted(toc_info.items(), key=lambda item: item[0]):
57+
posts = chapter[1]
58+
chapter_name = mapping[chapter[0]]
59+
print(f"- **{chapter_name}**")
60+
for post in sorted(posts.items(), key=lambda item:item[0]):
61+
# print title only
62+
# print(f"{post[1][0]}")
63+
print(" ", f"* [{post[1][0]}]({post[1][1]})")
64+
65+
def main():
66+
mapping = generate_mapping()
67+
toc_info = get_toc_info()
68+
print_md_toc(toc_info, mapping)
69+
70+
if __name__ == '__main__':
71+
main()

0 commit comments

Comments
 (0)