Python3中BeautifulSoup解析html常用函数

1,初始化: soup = BeautifulSoup(html)# html为html源代码字符串,type(html) == str 2,用tag获取相应代码块的剖析树:   contents属性是一个列表,里面保存了该剖析树的直接儿子,如:   3,用contents[], parent, nextSibling, previousSibling寻找父子兄弟tag:   beautifulS
相关文章
相关标签/搜索