清洗数据

# coding:utf-8
from bs4 import BeautifulSoup

ori = ''
soup = BeautifulSoup(ori, 'lxml')

datas = soup.select('p.tooltip-title')
nums = soup.select('div.tooltip-desc-0')
num_sons = soup.select('div.tooltip-desc-1')
crs = soup.select('div.tooltip-desc-2')

for data, num, num_son, cr in zip(datas, nums, num_sons, crs):
    print(data.get_text(), num.get_text(), num_son.get_text(), cr.get_text())

print('**************************************************************************************************')
print('支付件数')
for num in nums:
    print(num.get_text().split(':')[1])

print('**************************************************************************************************')
print('支付子订单数')
for num_son in num_sons:
    print(num_son.get_text().split(':')[1])

print('**************************************************************************************************')
print('支付转化率指数')
for cr in crs:
    print(cr.get_text().split(':')[1])

你可能感兴趣的:(清洗数据)