how to convert string into dictionary in python 3.*?
Question: I want to convert the following string into dictionary without using eval()
function in python 3.5 .

d="{'Age': 7, 'Name': 'Manni'}";

Can anybody tell me the good way than using the eval() function?? (Actually i
want to know about the function which can directly convert dictionary to
string.)


Answer:   1. `literal_eval`, a somewhat safer version of `eval` (will only evaluate literals ie strings, lists etc):
    
        from ast import literal_eval
    
    python_dict = literal_eval("{'a': 1}")
    

  2. `json.loads` but it would require your string to use double quotes:
    
        import json
    
    python_dict = json.loads('{"a": 1}')
    

