Copy codeThe Code is as follows :#! /Usr/bin/env python
# Python2.7-Batch download of wallpapers
# Wallpaper comes from the table store website and its ownership belongs to its website
# This code is only used for communication and learning. Do not use it for commercial purposes. Otherwise, the consequences will be borne by you.
# Code by Dreamlikes
Import re, urllib, urllib2
# Save the image path
Savepath = 'd: \ picture \\'
# The URL of the wallpaper set, as shown below:
Url = 'HTTP: // www.zhuoku.com/zhuomianbizhi/game-gamewall/20120504262540.htm'
UrlSource = urllib. urlopen (url). read ()
Pattern = re. compile (R' <a href = "(\ d + \) \. htm)" ', re. M | re. S)
Match = pattern. findall (urlSource)
If match:
For subUrl in match:
SubUrlSource = urllib. urlopen (url [0: url. rfind ('/') + 1] + subUrl). read ()
SPattern = re. compile (r 'var thunder_url = "(.*)";')
PicUrl = sPattern. findall (subUrlSource) [0]
GetPic = urllib2.Request (picUrl)
GetPic. add_header ('Referer', 'HTTP: // www.zhuoku.com ')
F = open (savepath + picUrl [picUrl. rfind ('/') + 1:], 'wb ')
F. write (urllib2.urlopen (getPic). read ())
F. close ()
Print "All done ."