8.1 Paths and the file system
The text string that describes how to get from the top of the file system to the exact file we want is called the pathname. Think of it as a set of directions to navigate to the information we want.
The tree in Figure 8.1 shows a subset of the folders and files I used to create this book.
The full path to the file Working-with-Files.html
on Linux
and macOS has the pathname
/src/part-I/Working-with-Files.html
On Microsoft Windows, we would have a drive letter like “C:
”, and we use backslashes instead of slashes. The pathname’s case
is not significant on Windows, but it is on the other operating systems.
C:\src\part-I\Working-with-Files.html
I will use slashes, and most Python routines that work with pathnames will work with either on...