fork download
  1. import json
  2.  
  3. # 原始字符串
  4. raw_string = '[]|1007651102246_PC--chefgapparoniTTV|'
  5.  
  6. # 提取 UID
  7. uid = 1007651102246 # 假設從字符串中提取的 uid
  8. name = "acc_Jacky" # 根據需要指定的名稱
  9.  
  10. # 創建字典
  11. data = {
  12. "uid": uid,
  13. "name": name
  14. }
  15.  
  16. # 轉換為 JSON
  17. json_data = json.dumps(data)
  18. print(json_data)
Success #stdin #stdout 0.02s 7324KB
stdin
Standard input is empty
stdout
{"uid": 1007651102246, "name": "acc_Jacky"}