用python的open()函数打开文件时,

1、文件写绝对路径报IOError: [Errno 2] No such file or directory。文件改为相对路径(只写文件名)解决该问题

2、文件是docx类型,如下代码执行时报TypeError: file() takes at most 3 arguments (4 given)path = r'file2.docx#ignore 忽略错误

f = open(path, 'r',encoding = 'utf-8',errors = 'ignore'
f = io.open(path, 'r',encoding = 'utf-8',errors = 'ignore')

相关文章:

  • 2022-12-23
  • 2021-06-16
  • 2021-05-31
  • 2021-06-17
  • 2022-01-11
  • 2021-10-26
  • 2021-05-26
  • 2023-01-09
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
相关资源
相似解决方案