Home > Software design >  Convert tuple of list to list
Convert tuple of list to list

Time:05-20

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?

CodePudding user response:

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

  • Related