title: Using beautifulsoup to extract text in spans between two headers
body: <p>I'm trying to use BeautifulSoup to scrape some text from a gig guide with listings by genre. I'm completely new to this, and I'm finding that I can return a list of genres and a full list of gig titles, but of course I only want to return gig titles associated with a particular genre (and then move to the next genre and pick up its gig-titles etc.) The source code for the gig guide is along these lines:</p>
  
  <pre><code>&lt;h3&gt;indie&lt;/h3&gt;
      &lt;span class="gig-title"&gt;&lt;a href="/gig/BandA"&gt;BandA&lt;/a&gt;&lt;/span&gt; 
      &lt;span class="gig-title"&gt;&lt;a href="/gig/BandB"&gt;BandB&lt;/a&gt;&lt;/span&gt; 
      &lt;span class="gig-title"&gt;&lt;a href="/gig/BandC"&gt;BandC&lt;/a&gt;&lt;/span&gt; 
  
  &lt;h3&gt;jazz&lt;/h3&gt;
      &lt;span class="gig-title"&gt;&lt;a href="/gig/BandD"&gt;BandD&lt;/a&gt;&lt;/span&gt; 
      &lt;span class="gig-title"&gt;&lt;a href="/gig/BandE"&gt;BandE&lt;/a&gt;&lt;/span&gt;
  </code></pre>
  
  <p>I can find all the genres and gig-titles with something like:</p>
  
  <pre><code>genres = soup.find_all("h3")
  for genre in genres:
      titles = soup.find_all("span","gig-title")
      for title in titles:
          gig = title.a.string
  </code></pre>
  
  <p>But, I just want to return the text: "BandA", "BandB", "BandC" - that's the text between two h3 (genre) tags, before moving on to the next genre.</p>
  
  <p>How I might approach this problem?</p>