Why would `eval('dict('+s+')')` work but not `literal_eval('dict('+s+')')`?
I could do this with eval(): >>> s = ‘hello=True,world="foobar"’ >>> eval(‘dict(‘+s+’)’) {‘hello’: True, ‘world’: ‘foobar’} but with literal_eval(): >>> from ast import literal_eval >>> literal_eval(‘dict(‘+s+’)’) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py", line 110, in literal_eval return _convert(node_or_string) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py", line 109, in _convert return _convert_signed_num(node) ^^^^^^^^^^^^^^^^^^^^^^^^^… Read More Why would `eval('dict('+s+')')` work but not `literal_eval('dict('+s+')')`?