标签:
#-*- encoding: utf-8 -*- python2.7 ‘‘‘Created on 2015-11-27@author: max‘‘‘
import re,urllib,time,uuid,os
for i in re.findall(r‘img?src="(.+?\.jpg)"‘,urllib.urlopen("http://www.zhihu.com/collection/38624707").read().replace(" ",""),re.I):
if not os.path.exists(‘C:\\ATuGuo\\%s‘ %(str(time.localtime(time.time()).__getattribute__("tm_year"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mon"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mday")))):
os.makedirs(‘C:\\ATuGuo\\%s‘ %(str(time.localtime(time.time()).__getattribute__("tm_year"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mon"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mday"))))
urllib.urlretrieve(i,‘C:\\ATuGuo\\%s‘ %(str(time.localtime(time.time()).__getattribute__("tm_year"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mon"))+"-"+str(time.localtime(time.time()).__getattribute__("tm_mday")))+"\\%s.jpg" %str(uuid.uuid1()))
标签:
原文地址:http://www.cnblogs.com/guochaolang/p/5000646.html