发布时间:2019-09-11 07:46:27编辑:auto阅读(2109)
import requests import os url="http://lofter.nos.netease.com/sogou-Y1gxMDFIeFVHeWhCTkZaMEkzYWx1bGR5WEszQTdRTEZPcndxZWo3Q0dwTG1iZF9uVENpM0tCaUJNOXA1bmZkTA.jpg" root="F://pics//"; path=root+url.split('/')[-1] try: if not os.path.exists(root): os.mkdir(root) if not os.path.exists(path): r=requests.get(url) with open(path,'wb') as f: f.write(r.content) f.close() print("图片保存cg") else: print("保存失败") except: print('爬取失败')
2、在windows终端执行以上代码
上一篇: python模块:smtplib模块
下一篇: python web开发-flask中日
47848
46403
37291
34738
29321
25977
24923
19955
19549
18033
5798°
6421°
5936°
5965°
7071°
5920°
5950°
6446°
6408°
7787°