Skip to content
Advertisement

How to convert a list into a dictionary object and return from function? [closed]

Sample code below:

JavaScript

Output:

JavaScript

Wan’t to get rid of [square brackets] i.e. [{‘id’: 2, ‘amt’: 10.0}, {‘id’: 2, ‘amt’: 10.0}] that is being appended from the function call that returns results/rows as a list.

Tried converting the function call return to a dictionary object, but results are not as expected.

JavaScript

Output:

JavaScript

Advertisement

Answer

I believe you need list.extend

Ex:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement