title: Python loop efficiency
body: <p>I was just wondering if there is a more cpu efficient way of writing the following loop as I need to speed my program up?</p>
  
  <pre><code>for char in data:
      if char in self.key:
          match += chr(self.key.index(char))
  </code></pre>
  
  <p>Thanks in advance for any help.</p>