python 小说去除广告
2022-07-18 python 1314
path = "D:/downloads/xxx.txt"
def record_txt(s):
with open("out.txt", "a", encoding="utf-8") as f:
f.write(str(s) + "\n")
index = 0
with open(path, "r", encoding="utf-8") as f:
while True:
line = f.readline()
line = line.strip()
line = line.replace("---", "")
line = line.replace("记住手机版网址:m.", "")
line = line.replace("请记住本书首发域名:。手机版更新最快网址:", "")
line = line.replace("请记住本书首发域名:", "")
if line != "":
index = 0
record_txt(line)
if line == "":
index += 1
if index > 20:
break 很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论