Merge pull request #20 from cwiki-us-docs/naming_rules

创建用例索引的链接
This commit is contained in:
YuCheng Hu 2021-03-11 10:54:42 -05:00 committed by GitHub
commit cef94b0cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -9,8 +9,8 @@
- [第一个 Hello World 程序](docs/course/foundation/04_hello_world.md) - [第一个 Hello World 程序](docs/course/foundation/04_hello_world.md)
- [语言基础](docs/course/foundation/05_language_fundamentals.md) - [语言基础](docs/course/foundation/05_language_fundamentals.md)
- 其他小工具 - 附录索引
- [JWT](jwt/README.md) - [Python 用例索引](docs/appendix/01_use_cases.md)
- [MessagePack](message-pack/index.md) - [MessagePack](message-pack/index.md)
- [Protocol Buffers](protocol-buffers/index.md) - [Protocol Buffers](protocol-buffers/index.md)

View File

@ -3,7 +3,10 @@
import json import json
import ruamel.yaml as yaml
json_filename = 'resources/honeymoose_test.json' json_filename = 'resources/honeymoose_test.json'
yaml_filename = 'resources/honeymoose_test.yaml'
# Read and process JSON # Read and process JSON
with open(json_filename) as json_file: with open(json_filename) as json_file:
@ -15,3 +18,7 @@ with open(json_filename) as json_file:
print(str(label_id)) print(str(label_id))
print(json_file.closed) print(json_file.closed)
# Using with write to YAML
with open(yaml_filename, 'w') as yaml_file:
yaml.dump(data, yaml_file, allow_unicode=True)

View File

@ -2,6 +2,7 @@
# Author - HoneyMoose (https://www.ossez.com) # Author - HoneyMoose (https://www.ossez.com)
import json import json
import ruamel.yaml as yaml import ruamel.yaml as yaml
json_filename = 'resources/black_rock_test.json' json_filename = 'resources/black_rock_test.json'
@ -18,6 +19,5 @@ with open(json_filename) as json_file:
json_file.close() json_file.close()
# Write to YAML # Write to YAML
yaml_file = open(yaml_filename, 'w+') with open(yaml_filename, 'w') as yaml_file:
yaml.dump(data, yaml_file, allow_unicode=True) yaml.dump(data, yaml_file, allow_unicode=True)
yaml_file.close()