欧美人与性动交α欧美精品,边摸边吃奶做爽A片视频,亚洲精品动漫免费二区,刺激一区仑乱

Section Menu:  

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

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

描述

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


 
語法

以下是 dict2json_file() 的語法:

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

參數(shù)

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


返回值

無返回值。


實(shí)例

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

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

以上實(shí)例運(yùn)行后輸出的結(jié)果為:

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

適應(yīng)版本

v1.0.1