class person:
def __init__(self, name, gender):
self.name=name
self.gender=gender
b=person('bob','male')
b.name='bob'
b.gender='male'
Now I have a string 'bob', how can I get the object b?
Thanks a lot for all the answers and help. Let me be more clearer. If I assume there can only be unique names and my goal is to find bob's gender (I only know 'bob' but I do not know b). Is there a way to do so?
PersonFinderclass? Need more info'bob'or justpersonobjects that use that string? Can there be multiplepersonobjects usingbob?