Help with Dictionaries and Classes requested please.

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Aug 9 06:13:24 EDT 2007


special_dragonfly wrote:

> I've managed to solve the problem, I really was just being a
> dunce. Here's how incase anyone is wondering:
> 
> class MyClass:
>     def __init__(self):
>         name=""
> dict={}
> dict[0]=[]
> dict[0].append(MyClass())
> dict[0][0].name="Hello"
> print dict[0][0].name
> 
> I'm sorry if I've wasted anyones time, although if there's a
> better way of doing the above I'd still be interested to know.

Since we don't know what exactly of the above you require it's very
hard to give you useful tips. Do you need instance lists, grouped
by keys?

Regards,


Björn

-- 
BOFH excuse #152:

My pony-tail hit the on/off switch on the power strip.




More information about the Python-list mailing list