如何在python中修复“找不到此类文件错误”

时间:2019-04-08 12:07:17

标签: python-3.x jupyter-notebook

我正在尝试从字节文件中提取特征。

通过

打开文件时
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:[错误2]没有此类文件或目录:“ byteFiles / 01azqd4InC7m9JpocGv5”

0 个答案:

没有答案