import requests
import os
url="https://p1.ssl.qhimg.com/t015e3351debe4158e3.jpg"
root="F://picture//"
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("success to save document")
else:
print("document has saved")
except:
print("spyder wrong")
网友评论