Reverse repr function in Python [duplicate] Reverse repr function in Python [duplicate] python python

Reverse repr function in Python [duplicate]


I think what you're looking for is ast.literal_eval:

>>> s = repr("ab\r")>>> s"'ab\\r'">>> from ast import literal_eval>>> literal_eval(s)'ab\r'