I think a decode is also required to get a proper dict.
a= b"{'one': 1, 'two': 2}"
ast.literal_eval(a.decode('utf-8'))
**Output:** {'one': 1, 'two': 2}
The accepted answer yields
a= b"{'one': 1, 'two': 2}"
ast.literal_eval(repr(a))
**output:** b"{'one': 1, 'two': 2}"
The literal_eval hasn't done that properly with many of my codes so I personally prefer to use json module for this
import json
a= b"{'one': 1, 'two': 2}"
json.loads(a.decode('utf-8'))
**Output:** {'one': 1, 'two': 2}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…