I have a class in a module I that reads a plist (XML) file and returns a dict. This is extremely convenient because I can say something like:
Data.ServerNow.Property().DefaultChart
This returns a property dictionary, specifically the value for DefaultChart
. Very elegant.
However, assembling a dictionary this way fails:
dict={'Data': 'text1', 'Name':'text2', 'Place':'text3]}
dict
looks exactly like the Plist dict.
But when I say
print TextNow.Data().Name
I get error
'dict' object has no attribute 'Name'
But if I say
print TextNow.Data()['Name']
suddenly it works!
Can someone explain this behavior? Is there a way to convert a dict to an XML-ish dict?