Python下载网页图片

 蓝色智慧 发表于 2022年05月06日 软件编程  96
蓝色智慧
LV 7 [大学]
最后在线:13天前
加入时间:2年前
主帖:233  跟帖:5
# -*- coding:utf-8 -*-
import urllib.request
path = "D:\\Download"
url = "http://www.76w.net/mbrowser/img/1256.png"
name ="D:\\1.jpg"
#保存文件时候注意类型要匹配,如要保存的图片为jpg,则打开的文件的名称必须是jpg格式,否则会产生无效图片
conn = urllib.request.urlopen(url)
f = open(name,'wb')
f.write(conn.read())
f.close()
print('Pic Saved!')
论坛主帖
234
论坛跟帖
2
在线访客
3
今日主帖
0
今日跟帖
0
今日注册
0
265
http://www.76w.net/sq/index.php/gentie.html
http://www.76w.net/sq/index.php/postzan.html
http://www.76w.net/sq/index.php/postcai.html
http://www.76w.net/sq/index.php/postshoucang.html
http://www.76w.net/sq/index.php/gentiezan.html
http://www.76w.net/sq/index.php/gentiecai.html
http://www.76w.net/sq/index.php/huifu.html
http://www.76w.net/sq/index.php/xiugai.html
http://www.76w.net/sq/index.php/shanchugentie.html
1
XzA=
1
© 2023 天慧网·互动社区 版权所有
Powered by JianYuLunTan
蒙ICP备2021000971号-1
http://www.76w.net/sq/index.php/feedback.html
http://www.76w.net/sq/index.php/qiandao.html
http://www.76w.net/sq/index.php/denglu.html
0
http://www.76w.net/sq/index.php/adenglu.html
剑鱼论坛