转为bs4对象后,用select定位
soup.select(‘div’) 所有名为
的元素
soup.select(’#author’) 带有id属性,且id为author
soup.select(’.notice’) 所有使用CSS class属性,且为notice的
soup.select(‘div span’)
soup.select(’#author’) 带有id属性,且id为author
soup.select(’.notice’) 所有使用CSS class属性,且为notice的
soup.select(‘div span’)
之间的
soup.select(‘div>span’)
soup.select(‘div>span’)
之间的
,中间没有其他元素
soup.select(‘input[name]’) 有一个name属性的input
soup.select(‘input[type=‘button’]’) 有一个type属性,且值为button的input
soup.select(‘input[name]’) 有一个name属性的input
soup.select(‘input[type=‘button’]’) 有一个type属性,且值为button的input