[python-chinese] a wrapper for BeautifulSoup

William Xu william.xwl在gmail.com
星期六 九月 16 09:14:54 HKT 2006


cry <zyqmail在tom.com> writes:

> 作了一个小玩意,BeautifulSoup的wrapper。呵呵,学习加玩乐。如果谁知道有
> 人已经做过了,请告诉我。谢谢。
>
> 可以让你按照层次取得想要的东西。

这个似乎不是很有必要吧,用 BeautifulSoup 本身就可以了。例如,

f = urllib.urlopen(url)
soup = BeautifulSoup(f.read())

读取第一个 table 的第一行第一列:

soup('table')[0]('tr')[0]('td')[0]

-- 
William

Zall's Laws:
	(1) Any time you get a mouthful of hot soup, the next thing you do
	   will be wrong.
	(2) How long a minute is, depends on which side of the bathroom
	   door you're on.



关于邮件列表 python-chinese 的更多信息