creating lists question?
Josef Meile
jmeile at hotmail.com
Thu Mar 25 04:10:21 EST 2004
spisatus wrote:
> I'm trying to create a series of list from a loop is this possible? Let me
> give you an example:
>
> list1 = ["aaa", "bbb", "ccc", "ddd", "eee"]
>
> for element in list1:
> a = element
> a = []
>
>
> I want a new list created for every element in list1, how can I do this.
>
> Thanks!!
> Spisatus
>
>
>
What's about a dictionary? It would do the trick as well:
listIds=["aaa", "bbb", "ccc", "ddd", "eee"]
lists={}
for element in listIds:
lists[element]=[]
test=lists['aaa']
test.append('foo')
print lists
Regards,
Josef
More information about the Python-list
mailing list