zoukankan      html  css  js  c++  java
  • 月度投资者数量

    import requests
    from lxml import etree
    from bs4 import  BeautifulSoup
    import  csv
    url = 'http://www.chinaclear.cn/cms-search/monthview.action?action=china&channelFidStr'
    
    res = requests.get(url)
    res.encoding = res.apparent_encoding
    data = etree.HTML(res.text)
    
    copy = '//*[@id="settlementList"]/table/tbody/tr/td/table/tbody/tr[{}]/td[2]/p/span//text()'    #可用格式化{}操作,其实数量少的话不如直接多写几个,还不用循环
    
    data_dict =[]
    f
    = open('e:\shuju\3.csv', 'w', newline="") writer = csv.writer(f) writer.writerow(('riqi', 'xinzeng', 'qimo')) for i in range(1,4): das = data.xpath(copy.format(i)) das = ''.join(das).replace('[','').replace(']','').replace("'",'') #把多余的括号去掉 data_dict.append(das)
    writer.writerow((data_dict)) f.close()
  • 相关阅读:
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    es5
    es5
    es5||es6
    es5
    5 个常用的软件质量指标
    Solr
  • 原文地址:https://www.cnblogs.com/zsf-note/p/12745546.html
Copyright © 2011-2022 走看看