title: How do I get at the contents of an iterator?
body: <p>I'm thoroughly puzzled. I have a block of HTML that I scraped out of a larger table. It looks about like this:</p>
  
  <pre><code>&lt;td align="left" class="page"&gt;Number:\xc2\xa0&lt;a class="topmenu" href="http://www.example.com/whatever.asp?search=724461"&gt;724461&lt;/a&gt; Date:\xc2\xa01/1/1999 Amount:\xc2\xa0$2.50 &lt;br/&gt;Person:&lt;br/&gt;&lt;a class="topmenu" href="http://www.example.com/whatever.asp?search=LAST&amp;amp;searchfn=FIRST"&gt;LAST,\xc2\xa0FIRST &lt;/a&gt; &lt;/td&gt;
  </code></pre>
  
  <p>(Actually, it looked worse, but I regexed out a lot of line breaks)</p>
  
  <p>I need to get the lines out, and break up the Date/Amount line. It seemed like the place to start was to find the children of that block of HTML. The block is a string because that's how regex gave it back to me. So I did:</p>
  
  <pre><code>text_soup = BeautifulSoup(text)
  text_children = text_soup.find('td').childGenerator()
  </code></pre>
  
  <p>I've worked out that <a href="https://stackoverflow.com/questions/13486036/why-is-this-listiterator-stuck">I can only iterate through <code>text_children</code> once</a>, though I don't understand why that is. It's a <code>listiterator</code> type, which I'm struggling to understand.</p>
  
  <p>I'm used to being able to assume that if I can iterate through something with a for loop I can call on any one element with something like text_children[0]. That doesn't seem to be the case with an iterator. If I create a list with:</p>
  
  <pre><code>my_array = ["one","two","three"] 
  </code></pre>
  
  <p>I can use <code>my_array[1]</code> to see the second item in the array. If I try to do <code>text_children[1]</code> I get an error:</p>
  
  <pre><code>TypeError: 'listiterator' object is not subscriptable
  </code></pre>
  
  <p>How do I get at the contents of an iterator?    </p>