29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import re
|
|
import os
|
|
|
|
SCRIPT_PATH = r"d:\code\XH-202626_科创企业特有风险的识别与管理\projects\XH-202626-presentation_ppt169_20260727\scratch\generate_all_svgs.py"
|
|
|
|
def clean_script():
|
|
with open(SCRIPT_PATH, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# 1. 替换 svg_footer 为空
|
|
old_footer_pattern = r'def svg_footer\(page_num\):[\s\S]*?\'\'\''
|
|
new_footer = 'def svg_footer(page_num):\n return ""'
|
|
content = re.sub(old_footer_pattern, new_footer, content)
|
|
|
|
# 2. 剔除 Emoji
|
|
emoji_chars = ['📄', '📊', '📋', '💻', '🔗', '⚡', '🏛', '🔬', '👑', '💰', '⚖', '🤖', '👔', '⚠️', '⚠', '🚀', '👩', '✅', '🌍', '📈', '👨', '💡', '🕸', '🎯', '👁', '🔍', '🛡', '👉']
|
|
for em in emoji_chars:
|
|
content = content.replace(f"{em} ", "")
|
|
content = content.replace(f"{em}", "")
|
|
|
|
with open(SCRIPT_PATH, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
|
|
print("✅ 成功移除所有 Emoji 与页脚脚注/页码!")
|
|
|
|
if __name__ == '__main__':
|
|
clean_script()
|