Python3中BeautifulSoup解析html常用函數

1,初始化: soup = BeautifulSoup(html)# html爲html源代碼字符串,type(html) == str 2,用tag獲取相應代碼塊的剖析樹:   contents屬性是一個列表,裏面保存了該剖析樹的直接兒子,如:   3,用contents[], parent, nextSibling, previousSibling尋找父子兄弟tag:   beautifulS
相關文章
相關標籤/搜索