How do I make Python dictionary members accessible via a dot "."?
For example, instead of writing mydict['val']
, I'd like to write mydict.val
.
Also I'd like to access nested dicts this way. For example
mydict.mydict2.val
would refer to
mydict = { 'mydict2': { 'val': ... } }
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…