title: python string comparison (==) not working
body: <p>Why the following String comparison is not working?
  I have the following code (I adapted it to make is simpler). I retrieve a player from the database and add it to a list of players. Then I loop on the list of player and try to find it, and even tho' the string is the same, the comparison return false..</p>
  
  <pre><code>def findPlayer2(self, protocol, playerId):
      cur = self.conn.cursor()
      cur.execute("SELECT playerId, playerName, rating FROM players WHERE playerId LIKE (%s)", [playerId])
      nbResult = cur.rowcount
      result = cur.fetchone()
      cur.close()
  
      if nbResult &gt; 0:
          player = Player(protocol, str(result[0]), str(result[1]), result[2])
          self.players.append(player)
  
      for player in self.players:
          id1 = str(player.playerId)
          id2 = str(playerId)
          print type(id1)
          print type(id2)
          print "Comparing '%s' with '%s'" % (id1, id2)
  
  # HERE IS THE COMPARISON
  
          if id1 == id2:
              print "Equal! Player found!"
              return player
          else:
              print "Not equal :("
  </code></pre>
  
  <p>Give the following result:</p>
  
  <pre><code>&lt;type 'str'&gt;
  &lt;type 'str'&gt;
  Comparing '11111111' with '11111111'
  Not equal :(
  </code></pre>