Nested List question

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Feb 24 16:38:09 EST 2016


On 24/02/2016 20:59, grsmith at atlanticbb.net wrote:
> All,
>
> Can you have a phython list like:
> ['George',
> 'Soros',
> ['99 First Street',
>    '33 Broadway Avenue', ['Apt 303'],
>    '1 Park Avenue'],
>    'New York', 'NY']
>
> In other words how do you correctly nest the
> ['Apt 303'] so it goes with 33 Broadway Avenue.
>
> Also, I tried several ways and could not figure out
> how to get the ['Apt 303'] out of the list. How can
> you do that. It is the ['Apt 303'] that is the problem,
> I know how to do the other elements.
>
> thanks
> George
>

As you've all ready had answers, I'd simply ask is a list the best data 
structure for your application?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list