How to I convert a string that contains a list of sets to list without changing the order of the sets?

I have a string that contains a list of sets – ‘[{13,18},{14,19}]’ I want it to be like this – [‘[13,18]’,'[14,19]’] When I use ast.literal_eval() the order of the sets gets changed – >>> >>> l1='[{13,18},{14,19}]’ >>> >>> >>> ast.literal_eval(l1) [{18, 13}, {19, 14}] >>> Please suggest how can I keep the order of the… Read More How to I convert a string that contains a list of sets to list without changing the order of the sets?

Python ast Libary – retreive value of Node inside a function call

Follow up question of here: Python ast Libary – how to retreive value of a specific node I use the following code to retreive {‘console_scripts’: [‘main=smamesdemo.run.main:main’]} import ast code = ”’extras_require={"dev": dev_reqs} x = 3 entry_points={ "console_scripts": ["main=smamesdemo.run.main:main"] }”’ for node in ast.walk(ast.parse(code)): if isinstance(node, ast.Assign) and node.targets[0].id == ‘entry_points’: expr = ast.Expression(body=node.value) ast.fix_missing_locations(expr) entry_points… Read More Python ast Libary – retreive value of Node inside a function call

How to convert this tree structure into a JS MemberExpression tree structure?

I have figured out a way to represent the expression a.b[c.d][e].f[g[h[i.j]]] using my own tree format. That expression, represented as a tree, looks like this: { "form": "nest", "link": [ { "form": "site", "name": "a" }, { "form": "site", "name": "b" }, { "form": "nest", "link": [ { "form": "site", "name": "c" }, { "form":… Read More How to convert this tree structure into a JS MemberExpression tree structure?