Python 文件操作Error: binary mode doesn't take an encoding argument

Posted dayuanzhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Python 文件操作Error: binary mode doesn't take an encoding argument相关的知识,希望对你有一定的参考价值。

Python 报错:ValueError: binary mode doesn‘t take an encoding argument

    在运行文件操作相关功能时报错:ValueError: binary mode doesn‘t take an encoding argument

 

上代码:

>>> with open("course_info","rb+",encoding="utf-8")as f: #rb+操作时不支持指定encoding参数

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: binary mode doesn‘t take an encoding argument

原因分析:rb+操作时不支持指定encoding参数

解决办法: 去掉encoding,改成 with open(‘course_info‘,‘rb+‘) as f:

以上是关于Python 文件操作Error: binary mode doesn't take an encoding argument的主要内容,如果未能解决你的问题,请参考以下文章

iOS打包上传ipa文件时,报错<ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 - New iPhone a

我得到 android.view.InflateException: Binary XML file line 24: Error inflating class

android.view.InflateException: Binary XML file line #16: Error&nbs

Android异常篇 “Binary XML file line # : Error inflating class”

android.view.InflateException: Binary XML file line #7: Error inflating class Toolbar

Cuda 错误 CUDA_ERROR_NO_BINARY_FOR_GPU