Skip to content

Commit 99388f6

Browse files
committed
更新html处理工具方法
1 parent 9c50029 commit 99388f6

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

‎tools/html.py‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,33 @@ def strip_html(input_html):
3030

3131
def read_file(file_path):
3232
"""
33-
读取文件
33+
一次读取全文件
3434
:param file_path:
3535
:return:
3636
"""
3737
with open(file_path, 'r') as f:
3838
return f.read()
3939

4040

41-
def save_file(file_path, text):
41+
def read_file_each_line(file_path):
42+
"""
43+
逐行读取文件
44+
:param file_path:
45+
:return:
46+
"""
47+
with open(file_path, 'r') as f:
48+
for each_line in f:
49+
yield each_line
50+
51+
52+
def save_file(file_path, text, save_type='w'):
4253
"""
4354
保存文件
4455
:param file_path:
4556
:param text:
4657
:return:
4758
"""
48-
with open(file_path, 'w') as f:
59+
with open(file_path, save_type) as f:
4960
f.write(text)
5061

5162

‎tools/proxy.json‎

Whitespace-only changes.

‎tools/proxy.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# encoding: utf-8
2+
__author__ = 'zhanghe'

0 commit comments

Comments
 (0)