PriceForecast/fix_remaining_bom.py
2025-11-06 09:13:16 +08:00

25 lines
712 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 修复剩余文件的BOM字符
import os
# 剩余需要修复的文件
remaining_files = [
'd:\\code\\PriceForecast-svn\\main_juxiting_yuedu.py',
'd:\\code\\PriceForecast-svn\\main_juxiting_zhoudu.py'
]
# 修复文件
for file_path in remaining_files:
try:
with open(file_path, 'rb') as f:
content = f.read()
# 多次检查并移除BOM确保完全清除
while content.startswith(b'\xef\xbb\xbf'):
content = content[3:]
# 写回文件
with open(file_path, 'wb') as f:
f.write(content)
print(f"已修复: {file_path}")
except Exception as e:
print(f"修复失败 {file_path}: {e}")