成人黄网站A片免费观看,欧美人妻少妇精品久久黑人,国产内射999视频一区,国产成年女人毛片80S网站

Section Menu:  

字典存儲為json文件函數(shù):dict2json_file()

  • 發(fā)布時間: 2019-08-28 00:00
  •    閱讀: 2187   

描述

dict2json_file() 將字典存儲為json文件。
dict2json_file() 接收兩個參數(shù),第一個參數(shù)為要存儲的數(shù)據(jù),第二個參數(shù)為存放的路徑+文件名。


 
語法

以下是 dict2json_file() 的語法:

dict2json_file(dict, file='temp/temp.json')

參數(shù)

    ● dict [dict]:要存儲的字典數(shù)據(jù)。
    ● file [str]:要儲存的路徑+文件名。


返回值

無返回值。


實例

以下展示了使用 dict2json_file() 的實例:

from kyger.utility import dict2json_file
print(dict2json_file({"name": "kgcms", "www": "http://bfraz.cn"}, file='static/kgcms.json'))  # 將字典轉(zhuǎn)成json寫入到文件

以上實例運行后輸出的結(jié)果為:

# static/kgcms.json文件內(nèi)容:{"name": "kgcms", "www": "http://bfraz.cn"}

適應(yīng)版本

v1.0.1