TypeError: 'encoding' is an invalid keyword argument for this function

简介: TypeError: 'encoding' is an invalid keyword argument for this function

python 2.7版本


data_file = open("data.txt", "r", encoding='utf-8')

运行的时候报错:


TypeError: 'encoding' is an invalid keyword argument for this function

解决:


import io
data_file = io.open("data.txt", "r", encoding='utf-8')

相关文章
TypeError:Joi.validate is not a function 解决办法
TypeError:Joi.validate is not a function 解决办法
|
JavaScript
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
1642 0
react-Native init初始化项目报错”TypeError: cli.init is not a function“
react-Native init初始化项目报错”TypeError: cli.init is not a function“
1236 1
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
Error: Element type is invalid: expected a string (for built-in components) or a class/function
2724 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
|
C# Python
Python Tricks : Function Argument Unpacking
Python Tricks : Function Argument Unpacking
144 1
|
前端开发
Error in created hook: “TypeError: _test.default is not a function
Error in created hook: “TypeError: _test.default is not a function
|
前端开发
前后端数据交互-----ncaught (in promise) TypeError: this.registerAPI is not a function
前后端数据交互-----ncaught (in promise) TypeError: this.registerAPI is not a function
|
缓存
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
601 0
|
前端开发 JavaScript
Module build failed: TypeError: this.getResolve is not a function,vue写css时启动出错
Module build failed: TypeError: this.getResolve is not a function,vue写css时启动出错
99 0
Uncaught TypeError: l.push is not a function
Uncaught TypeError: l.push is not a function
126 0

热门文章

最新文章