即时尝试运行一个文件夹中的许多文件迭代,文件存在,如果我从文件打印文件,我可以看到他们的名字... Im very新编程,你能帮我一下吗?亲切的问候!IOError:[Errno 2]没有这样的文件或目录
import os
for path, dirs, files in os.walk('FDF\FDF'):
for file in files:
print file
fdf = open(file, "r")
IOError: [Errno 2] No such file or directory: 'FDF_20110612_140613_...........txt'
http://stackoverflow.com/a/9765314/1350424或 http://docs.python.org/2/tutorial/inputoutput.html#methods -of-file-objects – eclipsis
你应该使用你使用的技术(在这种情况下是python)添加标签,这样你的问题就会出现在相关的地方。我为你添加了它。 – mnagel
我对python没有经验,但对我来说''FDF \ FDF''这个反斜杠似乎很奇怪。路径通常使用'/'。 – mnagel