ast

Python code posted
created at 17 Jan 15:01

Edit | Back
1
2
3
4
5
6
7
8
>>> 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()))])"
295 Bytes in 2 ms with coderay