osEasy Examples

Interface to the OS: env vars, process management, file operations

Getting started with os

Basic import and usage of the os module.

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.

Common os operations

Frequently used functions from the os module.

python
# More os examples
import os

print(f"os module loaded successfully")
print(f"Location: {os.__name__}")
print(f"Has {len(dir(os))} attributes")

These are the most commonly used features of the os module.

Want to try these examples interactively?

Open Easy Playground