Hello, I am still fighting with parsing out the html text and this is what I have so far, but seems I keep hitting my head against a barrier.
>>> import os >>> from BeautifulSoup import BeautifulSoup >>> file = '/home/david/test/stack.html' >>> html = open(file, 'r') >>> soup = BeautifulSoup(html) >>> table = soup.find('table', {'class': 'order_tbl'}) >>> for row in table.findAll('td', {'class': 'order_tbl_price'}): >>> for td in row: >>> price = float(td.contents[1].lstrip(' $')) >>> td.contents[1].replaceWith('$%0.2f' % (price * 0.85)) My question now is do I have to close the html before I write to it, so that: >>> html.close() >>> html = open(file, 'w') >>> html.write(soup) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: argument 1 must be string or read-only character buffer, not instance >>> What am I doing wrong here? Thank you David ____________________________________________________ Guard your email - http://www.tiscali.co.uk/products/securemail/ ____________________________________________________ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor