获取图片做桌面壁纸

来源:互联网 发布:汪正扬看的编程书 编辑:程序博客网 时间:2024/03/28 20:47
#encoding:utf-8import urllib,re,timedef 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()

原创粉丝点击