title: Beautiful Soup: Copy a table to a new file
body: <p>I'm trying to use Beautiful Soup to isolate a specific <code>&lt;table&gt;</code> element and put it in a new file. The table has an id, <code>ModelTable</code>, and I can find it using <code>soup.select("#ModelTable")</code> ("soup" being the imported file).</p>
  
  <p>However, I'm having trouble figuring out how to get the element into a new file. Simply writing it to a new file (as in: <code>write(soup.select("#ModelTable")</code> ) doesn't work, as it's not a string object, and converting it with <code>str()</code> results in a string enclosed in brackets.</p>
  
  <p>Ideally I'd like to be able to export the isolated element after running it through <code>.prettify()</code> so that I can get a good HTML file right off the bat. I know I must be missing something obvious... any hints?</p>