eval() seems to be dangerous to use when processing unknown strings, which is what a part of my project is doing.
For my project I have a string, called:
<
yes, with ast.literal_eval which is safe since it only evaluates literals.
ast.literal_eval
>>> import ast >>> stringAsByte = "b'a'" >>> ast.literal_eval(stringAsByte) b'a'