os मॉड्यूल के साथ काम करना
वीडियो में, आपने अलग-अलग Python मॉड्यूल और उनके व्यावहारिक उपयोग देखे. os मॉड्यूल आपको अपने operating system से इंटरैक्ट करने देता है — directories में नेविगेट करना, environment settings जाँचना, और files मैनेज करना. अपनी current working directory और environment variables समझना, file access से जुड़ी समस्याओं को debug करने के लिए आवश्यक है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
इंटरमीडिएट Python फॉर डेवलपर्स
अभ्यास निर्देश
osमॉड्यूल इम्पोर्ट करें.- Current working directory प्राप्त करें.
- Environment variables जाँचें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import the os module
import ____
# Get the current working directory
print("Current working directory:", os.____())
# Check the environment variables
print("Environment variables:", os.____)