Created
December 14, 2019 19:05
-
-
Save prescod/049cd4d033f165cf12f019f7724ae107 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python | |
Python 3.6.8 (default, Feb 19 2019, 17:13:58) | |
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.10.44.4)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from ast import literal_eval | |
>>> literal_eval("100-20") | |
80 | |
>>> | |
$ pyenv shell 3.8.0 | |
Python 3.8.0 (default, Nov 27 2019, 09:28:55) | |
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from ast import literal_eval | |
>>> literal_eval("100-20") | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/Users/pprescod/.pyenv/versions/3.8.0/lib/python3.8/ast.py", line 96, in literal_eval | |
return _convert(node_or_string) | |
File "/Users/pprescod/.pyenv/versions/3.8.0/lib/python3.8/ast.py", line 95, in _convert | |
return _convert_signed_num(node) | |
File "/Users/pprescod/.pyenv/versions/3.8.0/lib/python3.8/ast.py", line 74, in _convert_signed_num | |
return _convert_num(node) | |
File "/Users/pprescod/.pyenv/versions/3.8.0/lib/python3.8/ast.py", line 66, in _convert_num | |
raise ValueError('malformed node or string: ' + repr(node)) | |
ValueError: malformed node or string: <_ast.BinOp object at 0x101b34100> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment