Another option if you want to limit the evaluation string to simple literals is to useast.literal_eval(). Some examples: importast# print(ast.literal_eval('')) # SyntaxError: unexpected EOF while parsing# print(ast.literal_eval('a')) # ValueError: malformed node or string# print(ast.lit...