Skip to content

Commit fbbbeba

Browse files
author
yincongxian
committed
Add the solution to 0009
1 parent 3d83489 commit fbbbeba

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

renzongxian/0009/0009.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Source:https://github.com/Show-Me-the-Code/show-me-the-code
2+
# Author:renzongxian
3+
# Date:2014-12-19
4+
# Python 3.4
5+
6+
"""
7+
8+
第 0009 题:一个HTML文件,找出里面的链接。
9+
10+
"""
11+
12+
import urllib.request
13+
import re
14+
15+
16+
def find_links(website):
17+
html_content = urllib.request.urlopen(website).read()
18+
r = re.compile('href="(.*?)"')
19+
result = r.findall(html_content.decode('GBK'))
20+
return result
21+
22+
if __name__ == '__main__':
23+
print(find_links('http://www.taobao.com/'))

0 commit comments

Comments
 (0)