python 字典的扩展变形
class AttrDict(dict): """ http://stackoverflow.com/questions/4984647/\ accessing-dict-keys-like-an-attribute-in-python http://bugs.python.org/issue1469629 """ def __init__(self, source): super(AttrDict, self).__init__(source) def __getattr__(self, key): return self[key] def __setattr__(self, key, value): self[key] = value