Working with the os module
In the video, you explored different Python modules and their practical applications. The os module lets you interact with your operating system - navigating directories, checking environment settings, and managing files. Understanding your current working directory and environment variables is essential for debugging file access issues.
This exercise is part of the course
Intermediate Python for Developers
Exercise instructions
- Import the
osmodule. - Get the current working directory.
- Check the environment variables.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the os module
import ____
# Get the current working directory
print("Current working directory:", os.____())
# Check the environment variables
print("Environment variables:", os.____)