mimo 0.0.0.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mimo-0.0.0.1.dist-info/METADATA +41 -0
- mimo-0.0.0.1.dist-info/RECORD +4 -0
- mimo-0.0.0.1.dist-info/WHEEL +5 -0
- mimo.py +7 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mimo
|
|
3
|
+
Version: 0.0.0.1
|
|
4
|
+
Summary: mimo
|
|
5
|
+
Description-Content-Type: text/markdown
|
|
6
|
+
Import-Name: mimo
|
|
7
|
+
|
|
8
|
+
# mimo
|
|
9
|
+
|
|
10
|
+
一个轻量级的 Python JSON 文件写入工具。
|
|
11
|
+
|
|
12
|
+
## 使用示例
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from mimo import write_json
|
|
16
|
+
|
|
17
|
+
data = {
|
|
18
|
+
"name": "mimo",
|
|
19
|
+
"version": "1.0.0",
|
|
20
|
+
"enabled": True,
|
|
21
|
+
"tags": ["json", "file", "python"]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
write_json("data/config.json", data)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
也可以使用 `Path` 对象:
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
write_json(Path("data/config.json"), {"name": "mimo"})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 行为约定
|
|
36
|
+
|
|
37
|
+
- 自动创建目标文件的父目录。
|
|
38
|
+
- 使用 `json.dumps()` 序列化对象。
|
|
39
|
+
- 使用 UTF-8 编码写入文件。
|
|
40
|
+
- 使用 `ensure_ascii=False` 保留中文字符。
|
|
41
|
+
- 目标文件已存在时,直接覆盖原文件。
|