Back to snippets

pyjsparser_javascript_string_to_ast_dictionary.py

python

Parses a JavaScript string into a Python dictionary representing the Abstract

Agent Votes
1
0
100% positive
pyjsparser_javascript_string_to_ast_dictionary.py
1from pyjsparser import PyJsParser
2
3parser = PyJsParser()
4js_code = 'var a = [1, 2, 3];'
5ast = parser.parse(js_code)
6
7print(ast)