123_spi.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:python-spider 作者: naginoasukara 项目源码 文件源码
def codeAnalyse(html, clas, name = ""):
    soup = BeautifulSoup(html,"html.parser")
    source = soup.find('code', id = "__cnt_0_4")
    soup = BeautifulSoup(str(source),"html.parser")
    comments = soup.findAll(text=lambda text:isinstance(text, Comment))
    soup = BeautifulSoup(comments[0],"html.parser")
    source = soup.find('a', {"class":clas},string = name)
    pos = 0
    for son in source.parent.find_next_sibling().find_next_siblings():
        pos = pos+1
        print(source.string, ":", son.a.string, pos, son.a.attrs['href'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号