代码如下:
html='''
<img src = "//s3plus.meituan.net/v1/mss_e2821d7f0cfe4ac1bf9202ecf9590e67/cdn-prod/file:5788b470/image/loading_2.e3d934bf.png"alt = "hah"class ="poster-default"/>
<img data-src = "https://p1.meituan.net/movie/20803f59291c47e1e116c11963ce019e68711.jpg@160w_220h_1e_1c"alt = "abc" class ="board-img"/>'''
from bs4 import BeautifulSoup
soup=BeautifulSoup(html,"lxml")
print(soup.prettify())
print(soup.findAll(attrs='data-src'))
输出的list为空
[]
我想用beautifulsoup 来获取data-src这个属性的值,也就是这个 "https://p1.meituan.net/movie/20803f59291c47e1e116c11963ce019e68711.jpg@160w_220h_1e_1c"
各位大神,**如果 不用 beautifulsoup 的 CSS 选择器**,怎么获取?