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.
Latihan ini adalah bagian dari kursus
Intermediate Python for Developers
Petunjuk latihan
- Import the
osmodule. - Get the current working directory.
- Check the environment variables.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
# Import the os module
import ____
# Get the current working directory
print("Current working directory:", os.____())
# Check the environment variables
print("Environment variables:", os.____)