Python Forum
Opening files in same directory as script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Opening files in same directory as script
#1
The textbook I am using didn't specify this problem so I want someone to help me.
I have a text file that is in the same directory as the script file. When I call file open, it tells me it cannot see it.
filehandle = open('box.txt')
The code returns an error that the file or directory doesn't exist.
What should I do to open it.
Reply


Messages In This Thread
Opening files in same directory as script - by Emekadavid - May-28-2020, 04:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to print directory files (& timestamps) chatguy 3 1,428 Dec-29-2022, 07:19 AM
Last Post: ndc85430
  traverses directory recursively and displays files Prani05 7 3,486 Apr-30-2020, 10:25 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020