Reputation: 11
i hav confirmed that "apples.txt" do exist.what is wrong with my code?
def Loadfile(fileName):
myfile=open(fileName,'r')
next(myfile)
for line in myfile:
linesplit=line.split()
print line
print Loadfile('apples.txt')
Upvotes: 1
Views: 3262
Reputation: 111
arq = open('C:\\python2.6\\projetos\\test\\list.txt', 'r')
texto = arq.readlines()
for linha in texto:
print(linha)
arq.close()
Upvotes: 0
Reputation: 117856
The file probably isn't in your working directory. Either change your working directory to where apples.txt
is located, or provide a full path to the file such as 'C:\\folder\\subfolder\\apples.txt'
Upvotes: 3