pyside 学习目标

官方文档 https://doc.qt.io/qtforpython/examples/index.html

1 获取配置信息

2022-9-28

 新建项目

 

 

 新建 config.yaml 文件内容如下

mysql:
host: "127.0.0.1"
port: 3306
user: "root"
password: "123456"
database: "test"

main.py代码
import yaml  # pip3 install pyyaml
import os

def print_hi(name):
# 在下面的代码行中使用断点来调试脚本。
print(f'Hi, {name}') # 按 Ctrl+F8 切换断点。

# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
print_hi('PyCharm')
with open(os.path.expanduser("config.yaml"), "r") as config:
cfg = yaml.safe_load(config)
print(cfg.get('mysql').get('host'))#读

with open(os.path.expanduser("config.yaml"), "w") as config0:
cases = {"f": {"name": "leaf", "age": 19}}
yaml.dump(cases, config0, allow_unicode=True)#写

2 写日志

3 数据库读写

4 mitmProxy的使用

 

posted @ 2022-09-28 12:38  simadi  阅读(34)  评论(0编辑  收藏  举报