On Tue, Jun 22, 2010 at 10:03 PM, Jerry Rocteur <mac...@rocteur.cc> wrote: >> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur <mac...@rocteur.cc> wrote: >> If you were able to ask us perhaps a more specific question >> and describe your problem a little more concisely perhaps >> I (and we) might have a bit more to offer you. > > I have a dictionary: > > users[key] = { 'user' : key, > 'secnum' : secnum, > 'name' : name > } > > Is it possible for me to code a class like this: > > class GRPUser(object): > def __init__(self, user, secnum, name, groups=None): > self.user = user > self.secnum = secnum > self.name = name > > Which would allow me to iterate through and access specific records ? > > How do I iterate through and access an individual user record! > > Thanks in advance,
I'm not sure what's wrong with your email client but I already answered this for you. To access an individual record given that you have a dict called "users" that holds a mapping of username to user record/object simply select an individual record by it's key (username). eg: >>> users["Bob Jane"] cheers James -- http://mail.python.org/mailman/listinfo/python-list