title: known the attribute of a class how to get the class in python
body: <pre><code>class person:    
      def __init__(self, name, gender):
          self.name=name
          self.gender=gender
  
  b=person('bob','male')
  b.name='bob'
  b.gender='male'
  </code></pre>
  
  <p>Now I have a string 'bob', how can I get the object b?</p>
  
  <p>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?</p>