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终端执行以上代码