title: How to get everything before and up to a certain substring within a string?
body: <p>How would I return a string up to a certain character?</p>
  
  <pre><code>def get_header(s):
      '''(str) -&gt; str
      Return the start of the given string upto and including
      &lt;/head&gt;.'''
      return (s.split('&lt;/head&gt;')[0])
  </code></pre>
  
  <p>this is what i did but, I don't know how i would get everything before the "  "&lt;"/heads">"" and including it.</p>
  
  <p>for example:</p>
  
  <pre><code>s ="hello python world &lt;/head&gt; , i'm a beginner "
  get_header(s)
  </code></pre>
  
  <p>this would return </p>
  
  <pre class="lang-none prettyprint-override"><code>"hello python world "&lt;"/head"&gt;"   #without the quotient marks around the &lt;
  </code></pre>