Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Intermediate Python for Developers

Cursus bekijken

Oefeninstructies

  • Import the os module.
  • Get the current working directory.
  • Check the environment variables.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Import the os module
import ____

# Get the current working directory
print("Current working directory:", os.____())

# Check the environment variables
print("Environment variables:", os.____)
Code bewerken en uitvoeren