无标题文章

# coding:utf-8
from bs4 import BeautifulSoup

wb_data='
商品名称当前状态

所有终端的

商品访客数

所有终端的

支付金额

所有终端的

加购件数

所有终端的

收藏人数

所有终端的

支付转化率

操作
' soup = BeautifulSoup(wb_data,'lxml') proName = soup.select('span.col.product')[0].get_text() a= soup.select('div.table-header.columns-5 > div.col.orderable.custom.col-0 > p.name')[0].get_text() b= soup.select('div.table-header.columns-5 > div.col.orderable.custom.col-1 > p.name')[0].get_text() c= soup.select('div.table-header.columns-5 > div.col.orderable.custom.col-2 > p.name')[0].get_text() d= soup.select('div.table-header.columns-5 > div.col.orderable.custom.col-3 > p.name')[0].get_text() e= soup.select('div.table-header.columns-5 > div.col.orderable.custom.col-4 > p.name')[0].get_text() titles = soup.select('div.col.product > p.title > a') # for i in range(len(titles)): # print(titles[i].get_text()) # print('http:' + titles[i].get('href')) aa =soup.select('span.col.num.custom.col-0') bb =soup.select('span.col.num.custom.col-1') cc =soup.select('span.col.num.custom.col-2') dd =soup.select('span.col.num.custom.col-3') ee =soup.select('span.col.num.custom.col-4') for a,b,c,d,e in zip(aa,bb,cc,dd,ee): # print(a.get_text()) # print(b.get_text()) # print(c.get_text()) print(d.get_text()) # print(e.get_text())
from bs4 import BeautifulSoup  
  
with open("ecologicalpyramid.html", "r") as ecological_pyramid:  
    soup = BeautifulSoup(ecological_pyramid,"html")  
producer_entries = soup.find("ul")  
print(type(producer_entries)) 

你可能感兴趣的:(无标题文章)