python-3.x - 如何在python中修复“找不到此类文件错误”
问题描述
我正在尝试从字节文件中提取特征。
通过打开文件时
with open('byteFiles/'+file,"r") as fp:
...
我收到错误“Nosuchfilefound”。我已经检查过该文件是否存在,甚至尝试在字节文件r
之前放置
with open(r'byteFiles/'+file,"r") as fp:
...
但我仍然无法修复它。
with open('byteFiles/'+file,"r") as fp:
lines=""
for line in fp:
a=line.rstrip().split(" ")[1:]
b=' '.join(a)
b=b+"\n"
text_file.write(b)
fp.close()
os.remove('byteFiles/'+file)
text_file.close()
我收到错误消息:
FileNotFoundError:[Errno 2] 没有这样的文件或目录:'byteFiles/01azqd4InC7m9JpocGv5'
解决方案
推荐阅读
- angular - 不使用主“模板”创建页面
- c# - 如何将带有数据的新列添加到已经显示数据的数据网格中?
- python - random.shuffle() 有多随机?
- c# - 如何修复sql中的无效列名
- casting - 如何将一片无符号整数转换为相同大小的有符号整数?
- javascript - 为什么 Vue.js 不打印对象属性,即使它存在?
- excel - 使用链接打开工作簿并使用它
- swift - 如何编写通用 ViewModel 和 ViewController 类。我试图从 ViewModel 访问变量但没有成功?
- javascript - 如何更新主表当前行的输入类型文本中的值从模态窗口表中获取值
- javascript - Formik:为什么在 onSubmit 中设置时间输出?