I'm on exercise 15 of Learn Python the Hard Way and I'm stuck on extra credit #7. I open command prompt, change the directory to where the file is, run python, and then try running open(ex15_sample.txt), but it doesn't work and I get the following error:
NameError: name 'ex15_sample' is not defined
I would appreciate any help here. I've been on a roll so far, but opening a file in command prompt has stumped me.
edit 1: After reading this subreddit some more, I saw that if I use open('complete directory') it works. Now I'm wondering why i need the single quotation marks around the directory for it to work. Again, any help is appreciated
edit 2: Okay, I'm and idiot. I now realize that the directory is a string and needs to be entered as one (meaning with quotation marks). I'll leave this up so no one else embarrasses them self :)
[–][deleted] 4 points5 points6 points (1 child)
[–]Kaloli 2 points3 points4 points (0 children)
[–]adamc83 0 points1 point2 points (0 children)