Skip to content

Commit 8e5e388

Browse files
committed
Eval
1 parent 9f52f19 commit 8e5e388

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,17 +1093,17 @@ Eval
10931093

10941094
### Detailed
10951095
```python
1096-
from ast import parse, Num, BinOp, UnaryOp, \
1097-
Add, Sub, Mult, Div, Pow, BitXor, USub
1096+
import ast
1097+
from ast import parse, Num, BinOp, UnaryOp
10981098
import operator as op
10991099

1100-
operators = {Add: op.add,
1101-
Sub: op.sub,
1102-
Mult: op.mul,
1103-
Div: op.truediv,
1104-
Pow: op.pow,
1105-
BitXor: op.xor,
1106-
USub: op.neg}
1100+
operators = {ast.Add: op.add,
1101+
ast.Sub: op.sub,
1102+
ast.Mult: op.mul,
1103+
ast.Div: op.truediv,
1104+
ast.Pow: op.pow,
1105+
ast.BitXor: op.xor,
1106+
ast.USub: op.neg}
11071107

11081108
def evaluate(expression):
11091109
root = parse(expression, mode='eval')

0 commit comments

Comments
 (0)