import urllib.requestimport re response = urllib.request.urlopen("http://tieba.baidu.com/p/2460150866")page = response.read()page = page.decode(‘utf-8‘) imageList = re.findall(r‘src="(.*?\.(jpg|png))" pic_ext‘,page) j = 1for i in imageList: imgUrl = i[0] urllib.request.urlretrieve(imgUrl,‘./images/%d.jpg‘%j) j += 1
时间: 2024-10-10 14:47:36