Drives, paths, slashes, hidden files, and where your work actually lives — the foundation for everything that follows.
/ versus \ — and why Python prefers /AppDataC:\actuarial_work\, outside OneDriveWhat a disk actually is — and why Explorer is only one (opinionated) view of it.
Programming tools talk to the file system directly, not to Explorer. When Explorer “hides” something, your code still sees it — and when Explorer shows a shortcut like Quick access, your code does not.
| Explorer says… | The real path is often… | Why it matters |
|---|---|---|
| Desktop | C:\Users\Jane\OneDrive\Desktop | May be silently synced to the cloud |
| Documents | C:\Users\Jane\OneDrive\Documents | Same — “Known Folder Move” |
| Downloads | C:\Users\Jane\Downloads | Usually not synced |
| Quick access / Home | nowhere — it’s a list of shortcuts | Can’t cd into it |
| This PC | nowhere — a virtual summary of drives | Not a real folder |
Click the Explorer address bar (or press Alt+D): the breadcrumb turns into the real path. Get into this habit now.
Every drive is an upside-down tree:
C:\Programmers say “directory”; Windows says “folder”. Same thing.
C:\
├── Program Files\ apps (admin only)
├── Windows\ the OS — hands off
├── Users\
│ └── Jane\ your "home"
│ ├── AppData\ hidden!
│ ├── Desktop\
│ ├── Documents\
│ └── Downloads\
└── actuarial_work\ ← we'll make this
└── pricing\
├── model.py
└── data\
└── input.csv
| Letter | Typically |
|---|---|
C: | The system drive — Windows, apps, users |
D:, E:… | Second disks, USB sticks, SD cards |
H:, S:… | Mapped network drives at work/school |
A: and B: were reserved for floppy disks — which is why the system drive is C:.
A mapped drive is a nickname for a UNC path:
H:\ → \\fileserver01\home\jane
S:\ → \\corp.local\shared\Actuarial
Network drives are slow for thousands of small files and may vanish off-VPN. Keep code and environments on your local disk.
A Python environment holds tens of thousands of small files. OneDrive tries to upload every one.
Sync locks files mid-write, then “resolves” conflicts with copies like model-LAPTOP-7F.py.
Cloud-only placeholders (☁) look present in Explorer but aren’t on disk when your code needs them.
Rule for this course: code lives in C:\actuarial_work\, which OneDrive doesn’t touch. Backups and history come from Git + GitHub (Module 5), which is designed for code.
Absolute vs. relative, and the tale of two slashes.
C:\Users\Jane\projects\model.py
C: — which volumeUsers\Jane\projects — the route down the treemodel — the file’s stem.py — what kind of fileAn absolute path starts at the root. It means the same thing no matter where you are.
Downside: it only works on your machine. Your colleague isn’t called Jane.
A relative path starts from the current working directory (CWD).
. | this folder |
.. | the parent folder |
data\input.csv | down into data |
..\data\input.csv | up one, then down |
C:\actuarial_work\pricing\
├── data\
│ └── input.csv
├── notebooks\ ← you are here
│ └── explore.ipynb
└── src\
└── model.py
From notebooks\, the data file is ..\data\input.csv.
From the project root it’s just data\input.csv.
Relative paths make projects portable: zip the folder, send it to a colleague, and every path still works.
Your CWD is C:\actuarial_work\pricing\src. Where does each point?
| Relative path | Resolves to |
|---|---|
model.py | C:\actuarial_work\pricing\src\model.py |
..\data\input.csv | C:\actuarial_work\pricing\data\input.csv |
..\.. | C:\actuarial_work |
.\..\src\.\model.py | C:\actuarial_work\pricing\src\model.py (silly but legal) |
/, back \, and escaping\/\ inside a string is an escape character: \n = newline, \t = tabThat innocent-looking path contains a newline and a tab. Python will look for a file that doesn’t exist — or error out.
# ❌ Broken: \n and \t are escape sequences
path = "C:\new_data\tables.csv"
# ✅ Option 1: forward slashes (preferred)
path = "C:/new_data/tables.csv"
# ✅ Option 2: a raw string — backslashes taken literally
path = r"C:\new_data\tables.csv"
# ✅ Option 3: escape each backslash
path = "C:\\new_data\\tables.csv"
/ — no drive letters/mnt/usb, /Volumes/USB/home/jane (Linux) or /Users/jane (macOS), shortened to ~Data.csv ≠ data.csv//server/share or smb://server/share/
├── bin/
├── etc/
├── home/
│ └── jane/ ~
│ └── actuarial_work/
└── mnt/
└── usb/ a "drive"
In UNIX, \ is never a path separator — in file paths or network paths. It is only an escape character.
/ — even on Windows/pathlib builds paths for you and prints them the native wayfrom pathlib import Path
project = Path("C:/actuarial_work/pricing")
data_file = project / "data" / "input.csv" # "/" joins parts
print(data_file) # C:\actuarial_work\pricing\data\input.csv
print(data_file.suffix) # .csv
print(data_file.exists()) # True / False
home = Path.home() # C:\Users\Jane (or /home/jane)
House rule: write / in your code; let Windows show you \ in Explorer.
File extensions, hidden items, and your user profile.
model.py.txtBy default, Explorer hides known file extensions. So:
model.py from Notepad.txt| Explorer shows | Actual name |
|---|---|
| model.py | model.py.txt |
| claims | claims.csv |
| invoice.pdf | invoice.pdf.exe ⚠️ |
The last row is a classic malware trick. Showing extensions is a security habit, too.
Once hidden items are visible, you’ll start seeing programmer furniture:
.git\ .venv\ .gitignore .python-version AppData\
Names starting with a dot are a UNIX convention for “hidden”; you’ll create plenty of them in this course.
C:\Users\<username>C:\Users\Jane\ %USERPROFILE%, $HOME, ~
├── .local\bin\ uv installs here (Mod 4)
├── AppData\ hidden
│ ├── Local\ caches, per-machine
│ ├── LocalLow\ sandboxed apps
│ └── Roaming\ settings that follow you
├── Desktop\
├── Documents\
├── Downloads\
├── OneDrive\
└── .gitconfig Git settings (Mod 5)
%USERPROFILE% — Explorer / cmd$HOME or ~ — PowerShellPath.home() — PythonType %USERPROFILE% or %LOCALAPPDATA% into Explorer’s address bar and press Enter.
AppData: where programs keep their stuff| Folder | Holds | Example |
|---|---|---|
AppData\Roaming%APPDATA% | Small settings meant to follow you between machines on a corporate network | Code\User\settings.json (VS Code) |
AppData\Local%LOCALAPPDATA% | Large, machine-specific data: caches, per-user installs | uv\cache\, Programs\Microsoft VS Code\ |
AppData\LocalLow | Low-trust / sandboxed apps (browsers, some games) | — |
Browse it to understand it — but don’t delete things in AppData unless you know which program owns them.
C:\Users\Jane\… and folders you create, like C:\actuarial_work.
Read, write, delete freely.
C:\Program Files, C:\Windows, other users’ profiles.
Triggers a UAC prompt.
A file open in another program — e.g. a workbook in Excel (look for ~$claims.xlsx).
“Permission denied” even though it’s yours.
Every tool in this course installs per-user, inside your profile. You should almost never need “Run as administrator”.
model.py.txt — then escapeC:\actuarial_work\ outside OneDriveA folder structure like this, verified via the address bar:
C:\actuarial_work\
└── sandbox\
├── data\
├── notebooks\
└── notes.txt
%USERPROFILE%. Find AppData (now visible, slightly faded).print("hello"), and Save As model.py on the Desktop with “Save as type: Text Documents”.model.py.txtmodel.py and accept the “change extension” warning.In Notepad’s Save dialog, choose All files (*.*) to prevent the extra .txt.
C:\actuarial_work\actuarial_work.sandbox, and inside that, data and notebooks.model.py from your Desktop into sandbox.C:\actuarial_work\sandbox — no OneDrive in the path.Use lowercase and underscores; no spaces. actuarial_work — not Actuarial Work. Spaces in paths cause quoting pain on the command line (Module 2).
Can’t create folders in C:\ on a locked-down work laptop? Use C:\Users\<you>\actuarial_work instead — still outside OneDrive.
| Keys | Action |
|---|---|
| Win+E | Open Explorer |
| Alt+D or Ctrl+L | Jump to address bar |
| Alt+↑ | Up to parent folder (..) |
| Alt+← / → | Back / forward |
| Type letters | Jump to matching item |
| F2 | Rename |
| Ctrl+Shift+C | Copy as path (Win 11) |
C:\actuarial_work\sandbox\data by typing the path.C:\ with only Alt+↑. How many presses?notes.txt in sandbox and copy its full path to the clipboard.wt in the address bar and press Enter. (Teaser for Module 2!). and .."C:\new\table.csv" breaks in Python, and three ways to fix it/ in code (or use pathlib)AppData, %USERPROFILE%, and ~ pointC:\actuarial_work\ exists, outside OneDriveEverything you just did with the mouse — faster, repeatable, and scriptable, with Windows Terminal and PowerShell.