python3用BeautifulSoup抓取a标签
Python3 标签 抓取 BeautifulSoup
2023-09-11 14:17:15 时间
# -*- coding:utf-8 -*- #python 2.7 #XiaoDeng #http://tieba.baidu.com/p/2460150866 from bs4 import BeautifulSoup import urllib.request html_doc = "http://tieba.baidu.com/p/2460150866" req = urllib.request.Request(html_doc) webpage = urllib.request.urlopen(req) html = webpage.read() soup = BeautifulSoup(html, 'html.parser') #抓取class='app_icon_link'的a标签 img_src=soup.findAll("a",{'class':'app_icon_link'}) #抓取a标签 for img in img_src: img=img.findAll('img') for k in img: k=k.get('src') print(k)
相关文章
- [进阶] --- Python3 异步编程详解(史上最全篇)
- Python2中的urllib、urllib2和 Python3中的urllib、requests
- Python3中bytes类型转换为str类型
- Centos7安装python3以及pip3
- Centos 7安装python3,pip超详细过程,以及各种报错解决方案
- python3用BeautifulSoup抓取div标签
- python3用BeautifulSoup用limit来获取指定数量的a标签
- python3用BeautifulSoup用字典的方法抓取a标签内的数据
- Python搭建编程环境-安装Python3解释器
- python2 and python3 difference - division
- PYTHON3.x报错:MODULENOTFOUNDERROR:NO MODULE NAMED “CRYPTO“ 解决方案
- python3编程基础之一:标识符