I'm trying to make it so this script
from BeautifulSoup import BeautifulSoup
import sys, re, urllib2
import codecs
html_str = urllib2.urlopen(URL).read()
soup = BeautifulSoup(html_str)
for row in soup.findAll("tr"):
for col in row.findAll(re.compile("td|th")):
for
sys.stdout.write((col.string if col.string else '') + '|')
print # Newline
sends it's output to a text file instead.