14.01
Completed
File Path Basics File Path Basics

Learn how Python finds files with relative paths, absolute paths, and the current working directory.

File Path Basics

Sounds useful?

Jump into the interactive version.

No setup. No account. Just Python.

Interactive Python lesson

File Path Basics in Python

A file name tells you what a file is called, but a file path tells Python where to find it. This Block introduces file names and extensions, relative and absolute paths, parent-folder navigation with .., and the current working directory. You will learn how to follow paths from Python's starting location and check that location with os.getcwd().

What you will learn:

  • Recognize file names, extensions, folders, and complete file paths
  • Tell the difference between relative and absolute paths
  • Navigate from the current folder with . and to a parent folder with ..
  • Check Python's current working directory with os.getcwd()
  • Spot common path mistakes involving folder order, capitalization, spaces, and extensions

Leave with a clear method for reading paths, building simple relative paths, and checking Python's starting location before you begin opening file contents.

> Start now 55 cards · about 7 min

Ready to practice this in the browser?

> Play now