Files
F6--/测试.py
T
2026-01-30 11:28:35 +08:00

12 lines
577 B
Python

file_path = r"C:\Users\Administrator.DESKTOP-7IC2USJ\Desktop\ARMASTลูกค้า 3.txt"
output_file_path = r"C:\Users\Administrator.DESKTOP-7IC2USJ\Desktop\ARMASTลูกค้า 215415.txt"
# 使用TIS-620编码读取文件,并处理可能的编码错误
with open(file_path, 'r', encoding='TIS-620', errors='replace') as file:
content = file.read()
# 直接将内容写入新的UTF-8编码文件
with open(output_file_path, 'w', encoding='UTF-8') as output_file:
output_file.write(content)
print(f"File has been converted and saved to {output_file_path}")