import json
control={"bw":100,"delay": "10ms","jitter": None,"loss": 0,"max_queue_size": None,
"speedup": 0,"use_htb": True}
json.dump(control,open('configuration.json','w'),indent=4)
step1:设计为字典的形式
注意:其中字典的定义需要注意
#自定义关键词
dic = {}.fromkeys({"metainfo","data_list"})
step2:使用json.dump函数