抓取bing图片的Python代码

import urllib import time def main(): url = 'http://www.bing.com' f = urllib.urlopen(url) html = f.read() f.close() a = html[html.index('//fd//hpk2'):] data = a[:a.index('/',id:')] url = data.replace('//', '') url = 'http://www.bing.com'+url name=time.strftime("%Y%m%d", time.localtime()) name=name+".jpg" urllib.urlretrieve(url,name) if __name__ == "__main__": main()

转自:http://dddspace.com/2010/07/get-daily-bing-picture.html

你可能感兴趣的:(python,bing,url,html,import,2010)