os
Stdlib — OS/FilePython 2.0+Beginner
Interface to the OS: env vars, process management, file operations
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
- Dependencies
- None — Python Standard Library
- Install
Included with Python
Learn by Difficulty
Quick Example
python
import os print(f"Current directory: {os.getcwd()}") print(f"Platform: {os.name}") print(f"CPU count: {os.cpu_count()}") print(f"Path separator: {os.sep}")
The os module is part of Python's standard library. Interface to the OS: env vars, process management, file operations.
Try in PlaygroundTags
stdlibfile-iosystemprocessenvironment
Related Items
pathlib
Stdlib — OS/File
Object-oriented filesystem paths (modern replacement for os.path)
sys
Stdlib — OS/File
Interpreter variables: argv, path, stdin, stdout, exit
shutil
Stdlib — OS/File
High-level file operations: copy, move, remove trees, archives
subprocess
Stdlib — Concurrency
Spawn and manage child processes: run(), Popen, pipes
glob
Stdlib — OS/File
Unix-style pathname pattern expansion (wildcards like *.txt)
platform
Stdlib — OS/File
Retrieve platform info (OS name, version, architecture)