lists in dictonaries ?

Andrew Thompson andrew.thompson at ashecastle.com
Thu Sep 19 11:11:13 CEST 2002


You can put any python objects into a python dictionary, even the
dictionary itself...

For example :

aList=[1,2,3,4]
anotherList=[4,5,6,7]

aDictionary={}

aDictionary['foo']=[aList,anotherList]

Then...

aDictionary['foo'][0] answers aList

aDictionary['foo'][1] answers anotherList


Andrew

-----Original Message-----
From: python-list-admin at python.org [mailto:python-list-admin at python.org]
On Behalf Of Manuel Hendel
Sent: 19 September 2002 08:47
To: Python List
Subject: lists in dictonaries ?

Is it possible to put lists in dictionaries? And is it also possible
to put multiple lists in a dictionary for one key?

Thanks,
    Manuel

-- 
I married beneath me. All women do. 
-Lady Nancy Astor, first woman member of the British Parliment  

-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list