我相信这一定很简单,但我找不到答案.
我有一个字典,如:
d = {'a': 1, 'b':2}
我想通过点表示法来访问它,例如: d.a
d.a
这SimpleNamespace是为此而设计的,但我不能将dict传递给SimpleNamespace构造函数.我收到错误:TypeError: no positional arguments expected
SimpleNamespace
TypeError: no positional arguments expected
如何从字典初始化SimpleNamespace?
python dictionary python-3.x
dictionary ×1
python ×1
python-3.x ×1