ast

Python code posted
created at 17 Jan 14:58

Edit | Back
1
2
3
4
5
6
7
8
9
10
>>> a, b = 1, 2

# The ast module gives us:

>>> import ast
>>> ast.dump(ast.parse('a, b = 1, 2'))
"Module(body=[Assign(targets=[Tuple(elts=[Name(id='a', ctx=Store()),
                                         Name(id='b', ctx=Store())],
ctx=Store())],
                    value=Tuple(elts=[Num(n=1), Num(n=2)], ctx=Load()))])"
335 Bytes in 2 ms with coderay