os module in the python

technical talkiess
0

 Os module in python:- 

import os

# cuurnet dir

# print(os.getcwd())

# isse directory change hoti hai

# print(os.chdir('C:\\'))


# puri file ko return karta hai

# print(os.listdir())

# single dir bana deta hai

# print(os.mkdir("test"))


# agar multiple dir banani hogi to aap mkdirs ka use kar sakte hai

# print(os.makedirs("make/test"))

# agar apko dir ko rename karna hai to aap rename function ka use kar sakte hai

# print(os.rename("make","best"))

# global vaiable ko return karta hai

# print(os.environ.get('path'))


# agar apko joink arna hai path ko

# iske use se wo correct path return karta hai aur nwanted value ko remove karta hai

# print(os.path.join("c:\\",'hary.txt'))


# agar apko checck karna hai path exists hai ya nahi hai... ye true or false return karta hai

#  

# print(os.path.exists("c:\\program files"))


# same aap file ke liye bhi kar sakte ho

# print(os.path.isfile('c:\\'))



# baki ka os module bhi check kar lena jaab time hoga taab python ki official site se
Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)