title: Case-insensitive string startswith in Python
body: <p>Here is how I check whether <code>mystring</code> begins with some string:</p>
  
  <pre><code>&gt;&gt;&gt; mystring.lower().startswith("he")
  True
  </code></pre>
  
  <p>The problem is that <code>mystring</code> is very long (thousands of characters), so the <code>lower()</code> operation takes a lot of time.</p>
  
  <p><strong>QUESTION:</strong> Is there a more efficient way?</p>
  
  <p>My unsuccessful attempt:</p>
  
  <pre><code>&gt;&gt;&gt; import re;
  &gt;&gt;&gt; mystring.startswith("he", re.I)
  False
  </code></pre>