原文位址:
https://www.crummy.com/software/BeautifulSoup/bs3/documentation.zh.html
原文 by Leonard Richardson ([email protected])
翻譯 by Richie Yan ([email protected])
###如果有些翻譯的不準确或者難以了解,直接看例子吧。###
Beautiful Soup 是用Python寫的一個HTML/XML的解析器,它可以很好的處理不規範标記并生成剖析樹(parse tree)。 它提供簡單又常用的導航(navigating),搜尋以及修改剖析樹的操作。它可以大大節省你的程式設計時間。 對于Ruby,使用Rubyful Soup。
- Navigating 剖析樹
-
parent
-
contents
-
string
-
andnextSibling
previousSibling
-
andnext
previous
- 周遊
Tag
- 使用标簽名作為成員
-
- Searching 剖析樹
- The basic find method:
findAll(name, attrs, recursive, text, limit, **kwargs)
- 使用CSS類查找
- 像
一樣調用tagfindall
-
find(name, attrs, recursive, text, **kwargs)
-
哪裡去了?first
- The basic find method:
- Searching 剖析樹内部
-
andfindNextSiblings(name, attrs, text, limit, **kwargs)
findNextSibling(name, attrs, text, **kwargs)
-
andfindPreviousSiblings(name, attrs, text, limit, **kwargs)
findPreviousSibling(name, attrs, text, **kwargs)
-
andfindAllNext(name, attrs, text, limit, **kwargs)
findNext(name, attrs, text, **kwargs)
-
andfindAllPrevious(name, attrs, text, limit, **kwargs)
findPrevious(name, attrs, text, **kwargs)
-