os module
Python's standard library module for interacting with the operating system. Provides functions for file and directory operations, environment variables, and path manipulation. Works cross-platform — the same code runs on Linux, Mac, and Windows. |
os.makedirs()
Creates a directory and any missing parent directories in the path. exist_ok=True silently succeeds if the directory already exists. exist_ok=False raises FileExistsError if the directory already exists. |
os.path.join()
Joins path components together using the correct separator for the current operating system. Safer than string concatenation — handles trailing slashes and separators automatically. On Linux/Mac uses /, on Windows uses \. |
Cheatography
https://cheatography.com
Python (OS module) Cheat Sheet (DRAFT) by blakecromar
A cheatsheet on the OS module
This is a draft cheat sheet. It is a work in progress and is not finished yet.