当前位置:网站首页>【无标题】
【无标题】
2022-07-06 14:53:00 【freshfox】
#-*- coding:utf-8 -*-
from bs4 import BeautifulSoup
import requests
def get_imgs(xml_name = 'output.xml'):
file = open('1.html', encoding='utf-8').read()
soup = BeautifulSoup(file, 'xml')
count =0
try :
for node in soup.findChildren('img'):
src = node['src']
count =count+1
if count > 3:
break
print ("src : " + src)
response = requests.get(src)
img = response.content
path = '%s.jpg' % (count)
with open(path, 'wb') as f:
f.write(img)
except Exception as e:
print("get exception " + e)
get_imgs()
边栏推荐
猜你喜欢
PVL EDI project case
Spatial domain and frequency domain image compression of images
Daily question 1: force deduction: 225: realize stack with queue
硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
Should novice programmers memorize code?
小常识:保险中的“保全”是什么?
Self made j-flash burning tool -- QT calls jlinkarm DLL mode
UE4蓝图学习篇(四)--流程控制ForLoop和WhileLoop
Memorabilia of domestic database in June 2022 - ink Sky Wheel
新手程序员该不该背代码?
随机推荐
[Digital IC hand tearing code] Verilog burr free clock switching circuit | topic | principle | design | simulation
Classification, function and usage of MySQL constraints
【雅思口语】安娜口语学习记录part1
AdaViT——自适应选择计算结构的动态网络
Anaconda installs third-party packages
The nearest common ancestor of binary (search) tree ●●
Assembly and interface technology experiment 5-8259 interrupt experiment
将MySQL的表数据纯净方式导出
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
Solve project cross domain problems
Management background --5, sub classification
OpenCV VideoCapture. Get() parameter details
anaconda安装第三方包
Aardio - 封装库时批量处理属性与回调函数的方法
解决项目跨域问题
Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
小常识:保险中的“保全”是什么?
如何实现文字动画效果
3DMAX assign face map
每日一题:力扣:225:用队列实现栈