新手求解,谢谢
import urllib.request
import re
req = urllib.request.urlopen('http://www.imooc.com/course/list')
buf = req.read().decode('utf-8')
listurl = re.findall(r'http:.+\.jpg',buf)
print(listurl)
i = 0
for url in listurl:
f = open(str(i)+'.jpg','wb')
req = urllib.request.urlopen(url)
buf = req.read()
f.write(buf)
i += 1
f.close()
出现问题: