这似乎有效
def __setitem__(self, key, value): if isinstance(key, tuple): node = self for i in key[:-1]: try: node = dict.__getitem__(node, i) except KeyError: node = node[i] = type(self)() return dict.__setitem__(node, i, value) return dict.__setitem__(self, key, value)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)