Skip to content

Commit 6e49d96

Browse files
committed
0013 done
1 parent 0e07e74 commit 6e49d96

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Rudy1224/0013/0013.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import urllib
2+
import re
3+
4+
def get_html(url):
5+
page = urllib.urlopen(url)
6+
html = page.read()
7+
return html
8+
9+
def get_img(html):
10+
reg = r'src="(.*?\.jpg)" bdwater='
11+
imgre = re.compile(reg)
12+
imglist = re.findall(imgre, html)
13+
i = 0
14+
for imgurl in imglist:
15+
urllib.urlretrieve(imgurl, '%s.jpg'%i)
16+
i+=1
17+
html = get_html('http://tieba.baidu.com/p/2166231880')
18+
print get_img(html)

0 commit comments

Comments
 (0)