Python AST: Evaluate an Expression

Do you want to convert a string of Python expression to Python object? Use ast

$ cat myast.py
import ast

exDict = '{"name": "1"}'
x = ast.literal_eval(exDict)
print(x)
$ python myast.py 
{'name': '1'}

Another Example

>>> import ast
>>> x = u'[ "A","B","C" , " D"]'
>>> x = ast.literal_eval(x)
>>> x
['A', 'B', 'C', ' D']
>>> x = [n.strip() for n in x]
>>> x
['A', 'B', 'C', 'D']

Reference