Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #64092
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: Building and accessing an array of dictionaries |
| Date | 2014-01-16 17:01 +0000 |
| References | <ad743135-a552-4cd6-ba1f-c492bf8bbb37@googlegroups.com> <CAPTjJmrMwTNmei6g92ArsdaWa6Y2Uw5ZFgpZXHkKWa=8M4U1Bw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5593.1389891738.18130.python-list@python.org> (permalink) |
On 16/01/2014 09:48, Chris Angelico wrote:
> On Thu, Jan 16, 2014 at 8:41 PM, Sam <lightaiyee@gmail.com> wrote:
>> I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary.
>>
>> dict = {'a':'a','b':'b','c':'c'}
>> dict2 = {'a':'a','b':'b','c':'c'}
>> dict3 = {'a':'a','b':'b','c':'c'}
>>
>> arr = (dict,dict2,dict3)
>>
>> What is the syntax to access the value of dict3->'a'?
>
> Technically, that's a tuple of dictionaries
For the benefit of lurkers, newbies or whatever it's the commas that
make the tuple, not the brackets.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Building and accessing an array of dictionaries Sam <lightaiyee@gmail.com> - 2014-01-16 01:41 -0800
Re: Building and accessing an array of dictionaries Chris Angelico <rosuav@gmail.com> - 2014-01-16 20:48 +1100
Re: Building and accessing an array of dictionaries Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-01-16 11:52 +0200
Re: Building and accessing an array of dictionaries Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-16 17:01 +0000
Re: Building and accessing an array of dictionaries Grant Edwards <invalid@invalid.invalid> - 2014-01-17 20:53 +0000
csiph-web