Hello Foss Python Community,
           I have a query

Class User:
     def __init__(self):
            self.name=''
            self.id=''
     def setuser(self,name,id):
            self.name=name
            self.id=id


User().setuser('deepak',5)
User().setuser('munna',6)
User().setuser('howday',9)


is there any easier solution i can return objects id that matches name
say as

for u in User:
    if(u.name=='deepak'):
        print u.id

I need to find out objects that matches attributes
Need to solve this problem Thanks in advance


Regards
Deepak Pant
[email protected]

-- 
FOSS Nepal mailing list: [email protected]
http://groups.google.com/group/foss-nepal
To unsubscribe, e-mail: [email protected]

Mailing List Guidelines: 
http://wiki.fossnepal.org/index.php?title=Mailing_List_Guidelines
Community website: http://www.fossnepal.org/

Reply via email to