鱼C论坛

 找回密码
 立即注册
查看: 839|回复: 0

如何爬小说呢?CSDN上的案例跑不成,为啥?

[复制链接]
发表于 2019-12-14 19:24:09 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. # -*- coding:UTF-8 -*-
  2. from bs4 import BeautifulSoup
  3. import requests
  4. if __name__ == "__main__":
  5.      target = 'http://www.biqukan.com/1_1094/5403177.html'
  6.      req = requests.get(url = target) html = req.text
  7.      bf = BeautifulSoup(html)
  8.      texts = bf.find_all('div', class_ = 'showtxt')
  9.      print(texts[0].text.replace('\xa0'*8,'\n\n'))
复制代码



原文链接:https://blog.csdn.net/c406495762/article/details/78123502
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-25 11:56

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表