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')

相关文章
|
6月前
TypeError:Joi.validate is not a function 解决办法
TypeError:Joi.validate is not a function 解决办法
|
10月前
|
JavaScript
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
VUE上传功能本地上传正常,打包上传后报错TypeError: ***.upload.addEventListener is not a function
426 0
|
10月前
react-Native init初始化项目报错”TypeError: cli.init is not a function“
react-Native init初始化项目报错”TypeError: cli.init is not a function“
580 1
|
1月前
|
缓存
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
pytest 运行测试函数报错的解决办法 TypeError: calling <function xxx> returned None, not a test
185 0
|
6月前
|
前端开发 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时启动出错
25 0
|
7月前
Uncaught TypeError: l.push is not a function
Uncaught TypeError: l.push is not a function
|
10月前
|
JavaScript 前端开发
Vue项目部署到服务器时上传报错“Uncaught (in promise) TypeError: s.upload.addEventListener is not a function”
使用vue-admin-element框架进行在本地文件上传以及富文本框中的文件上传是没有问题的,但是在上传部署vue项目到服务器上时,就会报如下图中一个错误。
794 0
|
计算机视觉
cv2.error: OpenCV(4.5.2) : -1 : error: (-5:Bad argument) in function ‘rectangle‘
cv2.error: OpenCV(4.5.2) : -1 : error: (-5:Bad argument) in function ‘rectangle‘
283 0
|
Dart 前端开发 JavaScript
Syntax Error: TypeError: this.getOptions is not a function
Syntax Error: TypeError: this.getOptions is not a function
477 0
Syntax Error: TypeError: this.getOptions is not a function
|
JavaScript
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“
236 0
[Vue warn]: Error in mounted hook: “TypeError: handler.call is not a function“

热门文章

最新文章