Array of dict or lists or ....?

Reedick, Andrew jr9445 at ATT.COM
Tue Oct 7 17:41:51 EDT 2008


> -----Original Message-----
> From: python-list-bounces+jr9445=att.com at python.org [mailto:python-
> list-bounces+jr9445=att.com at python.org] On Behalf Of Pat
> Sent: Tuesday, October 07, 2008 10:16 PM
> To: python-list at python.org
> Subject: Re: Array of dict or lists or ....?
> 

> 
> The Perl routine works fine and I'd like to emulate that behavior but
> since I've just starting learning Python I don't know the syntax for
> designing the data structure.  I would really appreciate it if someone
> could point me in the right direction.




states = {}

if 'georgia' not in states:
	states['georgia'] = {}

states['georgia']['fulton'] = {}
states['georgia']['fulton']['ps101'] = {}
states['georgia']['fulton']['ps101']['math'] = {}
states['georgia']['fulton']['ps101']['math']['max'] = 100
states['georgia']['fulton']['ps101']['math']['current'] = 33 


states['georgia']['dekalb'] = {}
states['georgia']['dekalb']['ps202'] = {}
states['georgia']['dekalb']['ps202']['english'] = {}
states['georgia']['dekalb']['ps202']['english']['max'] = 500
states['georgia']['dekalb']['ps202']['english']['current'] = 44 

print states


*****

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA621





More information about the Python-list mailing list