python dict 字典

json  dict  

# -*- coding: utf-8 -*-
import json

class Dict(dict):
def __missing__(self, key):
rv = self[key] = type(self)()
return rv $row_data=Dict() print(json.dumps(row_data,indent=4,ensure_ascii=False))

Python多重字典嵌套用法​

python  dict  

Python多重字典嵌套用法,方便调用.