3 ms·
Typo in your first eval example: >>> foo = { ... 'bar': 3 ... } >>> print(eval("foo['bar'[]")) Traceback (most recent call last):
by aftbit 6y ago
Typo in your first eval example:
>>> foo = {
... 'bar': 3
... }
>>> print(eval("foo['bar'[]"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
foo['bar'[]
^
SyntaxError: unexpected EOF while parsing
- __lazybyte 6y agoI think that's the extra opening square bracket. Should be: print(eval("foo['bar']"))