天天看點

pyside 學習目标

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

1 擷取配置資訊

2022-9-28

 建立項目

pyside 學習目标

 建立 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的使用

繼續閱讀