[英]Unicode Decode error using Jupyter notebook
I am trying to read .res files and this is the error I get :我正在尝试读取 .res 文件,这是我得到的错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 27: invalid continuation byte.
I tried studying similar problem solutions but nothing is working out.我尝试研究类似的问题解决方案,但没有任何结果。 Please find below my piece of code:
请在我的代码下面找到:
df = pd.DataFrame()
for filename in os.listdir():
#with open(filename, encoding='utf-8') as f:
#F=filename.read().split()
if filename.endswith(".res"):
Data=open(filename)
F=Data.read()
A .res file is usually a resource file written in C++ that contains compiled code which is used on Windows systems. .res 文件通常是用 C++ 编写的资源文件,其中包含在 Windows 系统上使用的编译代码。 It is not a text file, which is what your code assumes with
Data=open(filename)
and F=Data.read()
.它不是文本文件,这是您的代码使用
Data=open(filename)
和F=Data.read()
假定的Data=open(filename)
。 Please see this answer on how to access resource files in Python.请参阅本关于Python中如何访问资源文件的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.