update doutu.py.

master
newrain001 3 years ago committed by Gitee
parent 4c1011d151
commit 0cb71ac1e4
  1. 3
      doutu.py

@ -13,6 +13,7 @@ email : newrain_wang@163.com *
import requests import requests
from lxml import etree from lxml import etree
import time import time
import os
def getUrl(): def getUrl():
header = { header = {
@ -26,6 +27,8 @@ def getUrl():
for i in url: for i in url:
name = i.split("/")[-1] name = i.split("/")[-1]
result = requests.get(i) result = requests.get(i)
if not os.path.exists('./image'):
os.mkdir('image')
with open(f'image/{name}', 'wb') as f: with open(f'image/{name}', 'wb') as f:
f.write(result.content) f.write(result.content)
print(name,'已完成') print(name,'已完成')

Loading…
Cancel
Save