必应搜索的网址为:https://cn.bing.com/,该网站的背景图片会每日更新,使用python3获取该网站的html源码,解析出背景图片,保存到指定目录,并重命名为当前日期。
#!/usr/bin/python3
# get the picture from Bing
import re
import requests
import datetime
url = 'https://cn.bing.com/'
# directory to save the picture
dir = 'C:\\Users\\Liangjin\\Pictures\\Saved Pictures\\'
# get the source code of the web page
html = requests.get