#获取知乎的网站内容
import requests #数据请求模块 第三方模块 pip install requests
import re #正则表达式
#网页head头
heads = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'
}
def get_response(html_url):
response = requests.get(url=html_url, headers=heads)
return response url= 'https://zhuanlan.zhihu.com/p/435694901'
response_new = get_response(html_url=url)
print(response_new.text)
#<p data-pid="R1eByHKC">100. 如果你拥有一种超能力,你会用它去做什么</p>
html_data = re.findall('<p data-pid="\w+">(.*?)</p>', response_new.text)
print(html_data) for url in html_data:
print(url)

  

最新文章

  1. Ubuntu(Linux系统)虚拟机工具vmtools详细说明
  2. 最短路(代码来源于kuangbin和百度)
  3. SeaJS入门篇一 怎么使用query
  4. Maven的依赖和传递性质
  5. JavaWeb chapter10 JavaWeb开发模式
  6. Java基础--serialVersionUID
  7. Atitit 常见的树形结构 红黑树 &#160;二叉树 &#160;&#160;B树 B+树 &#160;Trie树&#160;attilax理解与总结
  8. 10大经典CSS3菜单应用欣赏
  9. 161118、linux(centos) 项目部署阶段相关命令汇总
  10. Codeforces Round #370 (Div. 2) A B C 水 模拟 贪心
  11. light oj 1205 - Palindromic Numbers 数位DP
  12. SQL千万级数据设计和优化
  13. Redis 命令 - Connection
  14. 桌面浏览器实现滑动翻页效果(Swiper)
  15. 《ICSharpCode快速解压缩帮助类》——即粘即用
  16. javascript location对象
  17. STL学习:STL库vector、string、set、map用法
  18. Azure Event Hub 技术研究系列3-Event Hub接收事件
  19. Spring + Mybatis&#160;集成原理分析
  20. 21 PagerTabStrip-PagerTitleStrip-viewPager

热门文章

  1. perl的学习:将分句脚本split-sentences.perl转为python脚本
  2. [Linux系统]安装时出现Requires: libc.so.6(GLIBC_2.17)(64bit) Requires: systemd Requires: libstdc++.so时解决办法
  3. Eureka服务剔除下线
  4. 智能插座的制作(esp01,继电器,arduino)
  5. 区间(环形)dp
  6. Visusl Studio使用技巧
  7. linuxz中压缩解压缩文件
  8. 关于SQLsever2012报错的一些经验总结
  9. 【笔记】gitlab+openldap使用memberof筛选登录用户
  10. EBS关于LPN的API【OM】