Skip to content

Commit 92fa039

Browse files
🆕 更新Python文档,新增多个模块的详细说明与示例
- 在多个文档中新增了`<DocCardList />`组件,提升了内容的结构化与可读性。 - 更新了`datetime`、`zoneinfo`、`calendar`等模块的文档,详细阐述了时间处理的工具链及其使用场景。 - 增加了`数字和数学模块`、`函数式编程模块`、`文件和目录访问`等模块的说明,增强了文档的全面性与实用性。 - 删除了冗余的`datetime`模块示例文件,优化了文档结构。
1 parent 5688614 commit 92fa039

File tree

31 files changed

+464
-76
lines changed

31 files changed

+464
-76
lines changed

docs/docs/选择编程语言/Python标准库/10加密服务/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 10
33
title: 加密服务
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/11通用操作系统服务/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 11
33
title: 通用操作系统服务
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/11通用操作系统服务/os.mdx

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -132,69 +132,4 @@ def get_files(dir_path):
132132
```python showLineNumbers
133133
dir = os.curdir
134134
get_files(dir)
135-
```
136-
137-
## Byte Code 编译
138-
139-
Python, Java 等语言先将代码编译为 byte code(不是机器码),然后再处理:
140-
141-
> .py -> .pyc -> interpreter
142-
143-
eval(statement, glob, local)
144-
145-
使用 eval 函数动态执行代码,返回执行的值。
146-
147-
exec(statement, glob, local)
148-
149-
使用 exec 可以添加修改原有的变量:
150-
151-
```python showLineNumbers
152-
a = 1
153-
exec('b = a + 10')
154-
print(b)
155-
```
156-
157-
```python showLineNumbers
158-
local = dict(a=2)
159-
glob = {}
160-
exec("b = a+1", glob, local)
161-
162-
print(local)
163-
```
164-
165-
compile 函数生成 byte code:
166-
compile(str, filename, mode)
167-
168-
```python showLineNumbers
169-
a = 1
170-
b = compile('a+2', '', 'eval')
171-
print(eval(b))
172-
```
173-
174-
```python showLineNumbers
175-
a = 1
176-
c = compile("b=a+4", "", 'exec')
177-
exec(c)
178-
print(b)
179-
```
180-
181-
```python showLineNumbers
182-
# abstract syntax trees
183-
import ast
184-
185-
tree = ast.parse('a+10', '', 'eval')
186-
ast.dump(tree)
187-
```
188-
189-
```python showLineNumbers
190-
a = 1
191-
c = compile(tree, '', 'eval')
192-
d = eval(c)
193-
print(d)
194-
```
195-
196-
```python showLineNumbers
197-
# 安全的使用方法 literal_eval ,只支持基本值的操作:
198-
b = ast.literal_eval('[10.0, 2, True, "foo"]')
199-
print(b)
200-
```
135+
```

docs/docs/选择编程语言/Python标准库/12命令行界面库/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 12
33
title: 命令行界面库
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/12并发执行/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ title: 并发执行
3030
因此为了进一步提高效率,我们使用协程来完成这个任务。在协程中,程序员在代码中编写`await`关键字来完成主动**上下文切换**
3131
:::
3232

33+
<DocCardList />

docs/docs/选择编程语言/Python标准库/14互联网数据处理/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 14
33
title: 互联网数据处理
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/15结构化标记处理工具/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 15
33
title: 结构化标记处理工具
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/16互联网协议和支持/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 16
33
title: 互联网协议和支持
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/17多媒体服务/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 17
33
title: 多媒体服务
44
---
5+
6+
<DocCardList />

docs/docs/选择编程语言/Python标准库/18国际化/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
sidebar_position: 18
33
title: 国际化
44
---
5+
6+
<DocCardList />

0 commit comments

Comments
 (0)