Traceback (most recent call last): File "D:\Python\程序练习\修改后的程序\解析1.py", line 15, in <module> print(f'{key}: {value}') UnicodeEncodeError: 'gbk' codec can't encode character '\xae' in position 20: illegal multibyte sequence During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Python\程序练习\修改后的程序\解析1.py", line 17, in <module> print(f'{key}: {" ".join(value.split())}') UnicodeEncodeError: 'gbk' codec can't encode character '\xae' in position 20: illegal multibyte sequence PDF文件头信息:
时间: 2024-02-06 10:02:27 浏览: 87
traceback-path-mapper:PyCharm无法处理来自远程服务器的回溯。 这是一个简单的脚本,用于修补Python回溯,将远程路径替换为本地路径
5星 · 资源好评率100%
这个错误提示显示,依然存在编码问题。建议您检查一下您的Python环境的编码设置,确保与PDF文件的编码一致。您可以尝试在代码中增加以下语句来设置Python环境的编码:
```python
import sys
sys.stdout.encoding="utf-8"
```
这样就可以将标准输出的编码设置为UTF-8,从而正确输出包含特殊字符的PDF文件头信息了。
阅读全文