1
逗人,如何收集的HTMLParser的數據在Python 3個
我需要收集的數據在下面的HTML字符串
parser.feed(<table><tr><td><a href="http://rads.stackoverflow.com/amzn/click/B00JX1ZS5O" target="_blank"><img src="https://images-na.ssl-images-amazon.com/images/I/41B39oDSGQL._SL160_.jpg" alt="Product Image" style='border:0'/></a></td><td><tr><td>List Price: <strike>$34.99</strike></td></tr><tr><td><b>Deal Price: $7.99</b></td></tr><tr><td>You Save: $2.00 (20%)</td></tr><tr><td>Sabrent 4-Port USB 3.0 Hub with Individual Power Switches and LEDs (HB-UM43)</td></tr><tr><td>Expires Jun 15, 2017</td></tr></td></tr></table>)
的陣列中,所以我用下面的,但
class MyHTMLParser(HTMLParser):
def handle_data(self, data):
self.Datacollected(data)
return (data)
parser = MyHTMLParser()
Collector=[]
Collector.append[parser.feed("HTML Code HERE")]
但它始終是空