我已经确认“ apples.txt”确实存在。我的代码出了什么问题?
def Loadfile(fileName):
myfile=open(fileName,'r')
next(myfile)
for line in myfile:
linesplit=line.split()
print line
print Loadfile('apples.txt')
最佳答案
该文件可能不在您的working directory中。将您的工作目录更改为apples.txt
所在的位置,或者提供文件的完整路径,例如'C:\\folder\\subfolder\\apples.txt'
关于python - IOError:Errno 2没有这样的文件或目录python,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29493444/