Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Convert tuple of list to list

Below is the tuple I’m using:

tupleA = ([{'std_name':'A','std_addr':'Peachtree Drive'},{'std_name':'B','std_addr':'Alameda Drive'}],)

I want it to convert into a single list of dict which would look like this –

myList = [{'std_name':'A','std_addr':'Peachtree Drive'},{'std_name':'B','std_addr':'Alameda Drive'}]

what is the best approach to convert this tuple?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Here it looks like you want the element inside the tuple, so if you do this:

myList = tupleA[0]

You’ll get the list inside the tuple

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading