I have the following string :
str = "{application.root.category.id:2}"
I would like to convert the above to a dictionary data type in python as in :
dict = {application.root.category.id:2}
I tried using eval() and this is the error I got:
AttributeError: java package ‘application’ has no attribute “root”
My current python is of <2.3 and I cannot update the python to >2.3 .
Any solutions ?
First, ‘dict’ is the type name so not good for the variable name.
The following, does precisely as you asked…
But if, as I expect, you want to add more mappings to the dictionary, a different approach is required.