Python literal_eval

literal_eval in Python

The literal_eval safely evaluate an expression node or a string containing a Python literal or container display. The string or node (a file) provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None. Python literal_eval is a function defined in “ast” class of built-in class library. The “ast” expands to Abstract Syntax Tree.