We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8751549 commit ee15ab8Copy full SHA for ee15ab8
exercise0008/html_parse.py
@@ -0,0 +1,18 @@
1
+# coding: utf-8
2
+# author: jessun
3
+# date: 2017/6/15 15:59
4
+# **第 0008 题:**一个HTML文件,找出里面的**正文**。
5
+import re
6
+
7
8
+def html_parse(input_file):
9
+ with open(input_file, 'rt', encoding='utf-8') as f:
10
+ html_content = f.read()
11
12
+ html_body = re.search(r'<body>(.*)</body>', html_content, re.S)
13
+ print(input_file+'的正文内容为')
14
+ print(html_body.group(1))
15
16
17
+if __name__ == '__main__':
18
+ html_parse("index.html")
0 commit comments