
Absolute File Path
- / (Root)
- /Work/report.doc
- /Work/Project
Working Directory
- It's basically the directory or folder that we're currently working from.
- Once we've established a working directory, then we can use what's called a relative file path to get to a file that we're
Relative File Path
- At Project folder, try to get to talk.ppt => ./talk.ppt
(The ./ signifies look in the current folder for this file.)
- At Work folder, try to get to talk.ppt => ./Project/talk.ppt
Going upward in the directory tree
- At Project folder, try to get to report.doc => ../report.doc
(We're inside this project folder, we're coming out of it to the parent folder, which is the work folder, and then we're getting hold of this file.)

- At main.py, try to get to report.doc => ./report.doc ⇒ report.doc
#Absolute
with open("/Users/andchang/Desktop/my_file.txt") as file:
contents = file.read()
print(contents)
#Relative
with open("../../Desktop/my_file.txt") as file:
contents = file.read()
print(contents)
- The absolute file path is always relative to the root of your computer. On Windows that's the C drive, usually anyways unless you've changed it. And on a Mac, it is the Macintosh HD.
- Now the relative file path is relative to your current working directory. So it depends on where you are and where you're trying to get to.