Python之爬虫-段子网

余生颓废 提交于 2020-04-02 14:58:07

Python之爬虫-段子网

https://ishuo.cn

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import requests

response = requests.get('https://ishuo.cn')
data = response.text
print(data)
r = re.findall('<div class="content">(.*?)</div>',data)
for i in r:
    print(i)

http://duanziwang.com/

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import requests

response =requests.get('http://duanziwang.com/')
data = response.text
result = re.findall('<a href="http://duanziwang.com/.*?.html">(.*?)</a>',data)



for i in result:
    print(i)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!