^(.*)DEBUG:
查找所有以DEBUG:结尾的
比较,先用python移除.annotation
, 因为beycompare不支持多行的正则表达式
import os
import re
def remove_annotations(directory):
annotation_pattern = re.compile(r'^\s*\.annotation[\s\S]*?\.end annotation', re.MULTILINE)
for root, _, files in os.walk(directory):
for file in files:
file_path = os.path.join(root, file)
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
new_content = annotation_pattern.sub('', content)
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)
if __name__ == "__main__":
directory_path = r'C:\Other\G\DEX 对比_20240629121317\b'
remove_annotations(directory_path)