I am a little stuck with zed shaw’s exercise 15.
Actually I had no problem with the original program,
but the problem is when I try out the extra credit
where he asks us to use raw input instead of argv.
so, this is the code I used
filename=raw_input("enter filename :")
print "here's your file %r" % filename
txt=open(filename)
print txt.read()
when it asks for filename, I give the path e:\python\ex15_sample.txt
I am getting the following error in
this line –> txt = open(filename)
and it further says
no such file or directory
So, what do I do?
Due to the fact that you are using Windows you could try have to use either a
/(forward slash) when entering a filename or use a double backslash for the path-seperator\\.To enter your filename you could then try
e:/python/ex15_sample.txtore:\\python\\ex15_sample.txt.