代码打包文件名有中文的文件时会变成乱码import osimport subprocessfrom alive_progress import alive_bar config_handlerdef pack_filessource_dir output_dir # 检查源目录和输出目录是否存在 if not ospathexistssource_dir or not ospathis
可能是因为在操作系统中使用的编码方式与Python默认编码方式不同导致的问题,可以尝试在代码中指定编码方式,例如:
output_file = os.path.join(output_dir, f'{file_name}.gz'.encode('utf-8').decode('latin1'))
原文地址: https://www.cveoy.top/t/topic/deQM 著作权归作者所有。请勿转载和采集!