Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
24 lines (17 loc) · 653 Bytes

File metadata and controls

24 lines (17 loc) · 653 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
#去除小说中的广告
path = r'G:\PythonProject\paChong\books\推理'
new_path = r'G:\PythonProject\paChong\temp'
for a, b, c in os.walk(path):
print(c)
for i in c:
f = os.path.join(path, i)
nf = os.path.join(new_path, i)
if f.endswith("txt"):
print(f)
with open(f, 'r') as oldFile:
for line in oldFile.readlines():
content = line.strip()
if content not in '支付宝搜索“276997”,领取支付宝红包,最高99元,每天可领取1次!':
with open(nf, 'a') as newFile:
newFile.write(content + '\n')
Morty Proxy This is a proxified and sanitized view of the page, visit original site.