TXT文档:查找“八九问题”文件。
本帖最后由 js66g 于 2024-6-18 23:41 编辑“八九问题”:
TXT文档中的星号敏感词(如“八九”敏感词)没经过校对而直接删除星号符,导致文档中字句不完整(缺“八九”字符),此种TXT文档姑且称之为“八九问题”。
场景:
1.文件夹中有1000个文件
2.查找有“八九问题”的文档
方案:
filenames_1 = os.listdir(path_1)
for filename_1 in filenames_1:
file3=codecs.open(os.path.join(path_1,filename_1),'r','utf-8')
html_doc=file3.read()
list_bajiu=["八九","独立","赤裸","汪洋","兽交","隐私","炸药","情色","高潮","大法"]
if "八九" not in html_doc:
print("bajiu result found..."+filename_1)
file3.close()
shutil.move(os.path.join(path_1,filename_1),os.path.join(path_3,filename_1))
页:
[1]