Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
About Lesson

1.     os.name()

                  यह फ़ंक्शन उस ऑपरेटिंग सिस्टम मॉड्यूल का नाम provide करता है जिसे वह import करता है। वर्तमान में, यह ‘posix’, ‘nt’, ‘os2’, ‘ce’, ‘java’ और ‘riscos’ को पंजीकृत करता है।

Example

import os

print(os.name)

Output

nt 

2.     os.mkdir()

           os.mkdir () फ़ंक्शन का उपयोग new directory को create करने के लिए किया जाता है।

import os

os.mkdir(“E:\newdir”) 

3.     os.getcwd()

                 यह फ़ाइल की current working directory (CWD) को return करता है।

import os

print(os.getcwd()) 

4.     os.rmdir()

                  rmdir() फ़ंक्शन specified directory को absolute और relative path से remove कर देता है। सबसे पहले, हमें current working directory को बदलनाहोगा और फिर फ़ोल्डर को delete करना होगा।

import os

os.rmdir(“d:\newdir”) 

os.chdir(“..”) 

os.rmdir(“newdir”)

error: Content is protected !!