python 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))