#encoding:utf-8
import urllib,re,time
def getpic():
mf = urllib.urlopen('http://cn.bing.com')
content = mf.read()
picurls = re.findall('url:\'(.*?)\',id',content)
today=time.strftime('%Y%m%d',time.localtime(time.time()))
descs=re.findall('今日图片故事</h3><a.*?>(.*?)<'.decode('utf-8'), content.decode('utf-8'))
desc=''
if descs:
desc=descs[0]
for pic in picurls:
p=urllib.urlopen(pic).read()
open(today+'_'+desc+'.jpg', 'wb').write(p)
getpic()
获取图片做桌面壁纸
最新推荐文章于 2022-05-04 18:26:05 发布